1.示例
%第一题 clear;clc t1=-0.5:0.01:2.5; t2=-1:0.01:5; f1=stepfun(t1,0)-stepfun(t1,2); f2=0.5.*t1.*(stepfun(t1,0)-stepfun(t1,2)); f3=conv(f1,f2); figure(1) subplot(3,1,1) plot(t1,f1) title('f1') subplot(3,1,2) plot(t1,f2) title('f2') subplot(3,1,3) plot(t2,f3*0.01) title('f1卷积f2')
%第二题 f=exp(-3.*t1).*sin(8.*t1).*stepfun(t1,0); h=exp(-2.*t1).*stepfun(t1,0); f3=conv(f,h); figure(2) subplot(3,1,1) plot(t1,f) title('f') subplot(3,1,2) plot(t1,h) title('h') subplot(3,1,3) plot(t2,f3*0.01) title('零状态响应')
%第三题 t1=-2:0.01:2; f1=stepfun(t1,0)-stepfun(t1,1); f2=2*(stepfun(t1,0)-stepfun(t1,1)); f=conv(f1,f2); figure(3) subplot(3,1,1) plot(t1,f1) title('f1') subplot(3,1,2) plot(t1,f2) title('f2') t2=-4:0.01:4; subplot(3,1,3) plot(t2,f*0.01) title('f')