t1len=length(t1); t2=0:tspan:3.5; t2len=length(t2);
t3=0:tspan:(t1len+t2len-2)*tspan;
f1=exp(-t1).*(heaviside(t1)-heaviside(t1-2)); f2=heaviside(t2)-heaviside(t2-3); w=conv(f1,f2); w=w*tspan;
subplot(3,1,1); plot(t1,f1);
title('f1信号波形'); grid on;
xlabel('时间t/s'); axis([0 7 0 2]); subplot(3,1,2); plot(t2,f2);
title('f2信号波形'); grid on;
xlabel('时间t/s'); axis([0 7 0 2]); subplot(3,1,3); plot(t3,w);
title('f1和f2信号卷积结果'); xlabel('时间t/s'); grid on;图像如下:
6. 编制一个m文件,求出抽样函数Sa(t)=sin(t)/t的傅立叶变换,并在一个窗口中画出抽样函数的时域波形和频谱图以及频谱函数反变换的波形。 程序如下:
close all;clear;clc; syms t;
Sa=sin(t)/t; subplot(3,1,1);
ezplot(Sa,[-10,10]); title('Sa(t)时域波形'); Fw=fourier(Sa); subplot(3,1,2); ezplot('abs(Fw)'); title('频谱图'); ft=ifourier(Fw) subplot(3,1,3); ezplot(ft);
title('频谱函数反变换的波形'); 图像如下:
实验结论
熟悉各个函数功能并掌握各种变化有助于进一步了解各种变化的方式和意义。利用Matlab可以求连续,有限时域的零状态响应,求连续,有限时域的零状态响应,Matlab可以大大提高效率,对于某些信号或响应给出一个直观解释和感受。
相关推荐: