Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- t=-2:1:6;
- x=[0,0,1,1,1,1,1,0,0];
- subplot(4,1,1);
- stem(t,x);
- hold on;
- grid on;
- axis equal;
- tt=-2:1:9;
- y=[0,0,0,1,2,3,2.5,2,1.5,1,0.5,0]
- subplot(4,1,2);
- stem(tt,y);
- grid on;
- axis equal;
- N = length(x) + length(y) -1
- subplot(4,1,3);
- for n=1:N
- z(n)=0;
- for k=1:n-1
- if k > length(x)
- x(k)=0;
- end
- if n-k > length(y)
- y(n-k)=0;
- end
- z(n)=z(n) + x(k) *y(n-k)
- end
- pause;
- stem(z);
- axis([0,20,0,20]);
- hold on;
- end
- % subplot(4,1,3);
- % stem(z);
- z1=conv(x,y);
- subplot(4,1,4);
- stem(z1);
- axis([0,20,0,20]);
Add Comment
Please, Sign In to add comment