close; clc; clear; n=0:3; x=cos(%pi*n/2); subplot(4,1,1) plot2d3(n,x) xtitle('x[n]','n') a=gca(); a.x_location="origin"; a.y_location="right"; poly1=a.children.children; poly1.thickness=3; poly1.foreground=2; plot(n,x,'r.') subplot(4,1,2) h=.5^n; plot2d3(n,h); xtitle('h[n]','n') a=gca(); a.x_location="origin"; a.y_location="right"; poly1=a.children.children; poly1.thickness=3; poly1.foreground=2; plot(n,h,'r.') y=convol(x,h) subplot(4,1,3) plot2d3(n,y(1:4)); xtitle('y[n]','n') plot(n,y(1:4),'r.') a=gca(); a.x_location="origin"; a.y_location="right"; poly1=a.children.children; poly1.thickness=3; poly1.foreground=2; clear y; X=fft(x,-1); H=fft(h,-1); Y=H.*X; y=fft(Y,1); subplot(4,1,4) plot2d3(n,y); xtitle('y[n]','n') plot(n,y,'r.') a=gca(); a.x_location="origin"; a.y_location="right"; poly1=a.children.children; poly1.thickness=3; poly1.foreground=2; plot(n,x,'r.')