gusucode.com > MATLAB仿真技术与应用__的配套例题和习题的matlab源代码 > 第四章/example1.m

    %MATLAB program4-1
%Solve Convolution problem
x=[1 4 3 5 1 2 3 5];    %输入两个序列
nx = -4:3;
h=[4 2 4 0 4 2];
nh=-3:2;
y =conv(x,h);         %求卷积
ny1=nx(1)+nh(1);
ny2=nx(length(nx))+nh(length(nh));
ny=[ny1:ny2];
subplot(3,1,1);
stem(nx,x);
title('输入');
subplot(3,1,2);
stem(nh,h);
title('冲激响应');
subplot(3,1,3);
stem(ny,y);
title('输出');