题目引入
![请添加图片描述](https://i-blog.csdnimg.cn/blog_migrate/13fda3ba0986e08bc0b9cc6bdd4e7173.jpeg)
MATLAB卷积计算
t=0:0.01:5; % 设置离散时间
f1=2*stepfun(t,1)-2*stepfun(t,3); % 用阶跃函数表示
f2=stepfun(t,0)-2*stepfun(t,1)+stepfun(t,2);
f3=conv(f1,f2); % 卷积
k=2*length(t)-1; % 卷积后步长
k3=linspace(2*t(1),2*t(end),k);
subplot(2,2,1)
plot(t,f1);
title('f1(t)')
xlabel('t')
ylabel('f1(t)')
subplot(2,2,2)
plot(t,f2)
title('f2(t)')
xlabel('t')
ylabel('f2(t)')
subplot(2,2,3)
plot(k3,f3);
h=get(gca,'position'); % 以下三行是设置第三个图形的大小
h(3)=2.33*h(3);
set(gca,'position',h);
title('f(t)=f1(t)*f2(t)');
xlabel('t');
ylabel('f(t)');
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a6f15aa4e0305fa4054a47db1fb0469a.png)