Plot the convolution result in MATLAB | CONVOLUTION using MATRIX method (Part 2)

Опубликовано: 30 Сентябрь 2024
на канале: Knowledge Amplifier
3,746
47

Check the part 1 of CONVOLUTION using MATRIX METHOD in MATLAB in the below link:

   • Convolution in MATLAB(without conv fu...  

Code:

Check the code in comment section


Code using conv function for the last program discussed in the video:

nx=[-3:3];
x_n=[3 11 7 0 -1 4 2];
subplot(3,1,1);
stem(nx,x_n);
nh=[-1:4];
h_n=[2 3 0 -5 2 1];
subplot(3,1,2);
stem(nh,h_n);
n1=min(nx)+min(nh);
n2=max(nx)+max(nh);
nfinal=n1:n2;
y=conv(x_n,h_n);
subplot(3,1,3);
stem(nfinal,y);