1、成都理工大学信号与系统实验报告资料信号运算及系统分析实验摘要实验的内容:1、MATLAB应用基础 2、常用信号的表示与计算 3、系统时域分析及MATLAB实现4、连续系统的频域分析方法 5、连续系统的复频域分析方法 6、离散系统的Z域分析方法采用的方法:MATLAB实验的目标:让学生具备扎实的信号分析的基本方法和理论。关键字: 信号的运算;傅里叶变换;拉普拉斯变换;Z变换;Matlab。第1章 信号的时域分析1.1自定义函数1.1.1第1个自定义函数利用MATLAB绘出下列信号的时域波形。解:syms t k f1=sym(t*t-1)*(heaviside(t+1)-heaviside(t-
2、1)subplot(2,2,1)ezplot(f1)title(f1)1.1.2解:f2=sym(exp(-t)*cos(10*pi*t)*(heaviside(t-1)-heaviside(t-2)subplot(2,2,2)ezplot(f2)title(f2)1.1.3解:k=-5:0.5:5f3=sin(pi*k/4).*heaviside(k)subplot(2,2,3)stem(f3,filled)title(f3)1.1.4解:f4=k.*heaviside(-k+2)subplot(2,2,4)stem(f4,filled)title(f4)1.2.1第2个自定义函数已知信号波
3、形,利用MATLAB绘出满足下列需求的信号波形。解:syms t f1=sym(t*heaviside(t)-t*heaviside(t-1)+heaviside(t-1)-heaviside(t-3)subplot(2,3,1),ezplot(f1)title(f(t)f2=subs(f1,t,2-t)subplot(2,3,2)ezplot(f2)title(f(2-t)1.2.2解:f3=subs(f1,t,2*t-2)f4=-f3subplot(2,3,3)ezplot(f4)title(f-(2t-2)1.2.3解:f5=subs(f1,t,t/3)*heaviside(3-t)su
4、bplot(2,3,4)ezplot(f5)title(f(t/3)u(3-t)1.2.4解:f6=int(f1)subplot(2,3,5)ezplot(f6)title(积分)1.3.1第3个自定义函数已知离散序列波形,试用MATLAB绘出满足下列需求的序列波形。解:syms k k=-2:3f1=(k+3).*(heaviside(k+3)-heaviside(k)+3*(heaviside(k)-heaviside(k-4)subplot(2,3,1)stem(f1,filled)title(f(k)f2=subs(f1,k,k-2).*heaviside(k)subplot(2,3,
5、2)stem(f2,filled)title(f(k-2)*u(k)1.3.2解:f3=subs(f1,k,-k)subplot(2,3,3)stem(f3,filled)title(f(-k)1.3.3解:f4=subs(f1,k,-k+2)subplot(2,3,4)stem(f4,filled)title(f(-k+2)1.3.4解:f5=subs(f1,k,k-2).*heaviside(k-2)subplot(2,3,5)stem(f5,filled)title(f(k-2)u(k-2)第2章 系统时域分析及MATLAB实现2.1自定义函数2.1.1第1个自定义函数已知连续信号f1(
6、t)与f2(t),试利用MATLAB绘出f1(t)*f2(t)的时域波形。解:function f,k=sconv(f1,f2,k1,k2,p)f=conv(f1,f2);f=f*p;k0=k1(1)+k2(2);k3=length(f1)+length(f2)-2;k=k0:p:k0+k3*p;subplot(2,2,1)plot(k1,f1)title(f1(t)xlabel(t)ylabel(f1(t)subplot(2,2,2)plot(k2,f2)title(f2(t)xlabel(t)ylabel(f2(t)subplot(2,2,3)plot(k,f);h=get(gca,pos
7、ition);h(3)=2.5*h(3);set(gca,position,h)title(f(t)=f1(t)*f2(t)xlabel(t)ylabel(f(t)p=0.01;k1=0:p:2;f1=k1;k2=k1;f2=0.5*k2;f,k=sconv(f1,f2,k1,k2,p)2.1.2已知序列f1(k)、f2(k),编写M文件求离散卷积和f1(k)*f2(k),并绘出其波形。解:function f,k=dconv(f1,f2,k1,k2)f=conv(f1,f2);k0=k1(1)+k2(1);k3=length(f1)+length(f2)-2;k=k0:k0+k3;subpl
8、ot(2,2,1)stem(k1,f1)title(f1(k)xlabel(k)ylabel(f1(k)subplot(2,2,2)stem(k2,f2)title(f2(k)xlabel(k)ylabel(f2(k)subplot(2,2,3)stem(k,f);h=get(gca,position);h(3)=2.5*h(3);set(gca,position,h)title(f(k)=f1(k)*f2(k)xlabel(k)ylabel(f(k)f1=0,1,2,3,3,3,3,0,0;k1=-3:5;f2=0,1,2,3,2,1,0;k2=-3:3;f,k=dconv(f1,f2,k1
9、,k2)2.1.3已知离散系统激励函数x(n)=(n+2)+2(n+1)+(n)+(n-1)+2n-2),h(n)=(n+2),是利用MATLAB绘出该系统的零状态响应时域波形。解:function f,k=dconv(f1,f2,k1,k2)f=conv(f1,f2);k0=k1(1)+k2(1);k3=length(f1)+length(f2)-2;k=k0:k0+k3;subplot(2,2,1)stem(k1,f1)title(f1(k)xlabel(k)ylabel(f1(k)subplot(2,2,2)stem(k2,f2)title(f2(k)xlabel(k)ylabel(f2
10、(k)subplot(2,2,3)stem(k,f);h=get(gca,position);h(3)=2.5*h(3);set(gca,position,h)title(f(k)=f1(k)*f2(k)xlabel(k)ylabel(f(k)f1=1,2,1,1,2;k1=-2:2;f2=1;k2=-2;f,k=dconv(f1,f2,k1,k2)2.1.4已知系统的微分方程为:y(t)+4y(t)+3y(t)=x(t)+2x(t),试用MATLAB完成下列各题;(1)绘出该系统的单位冲击响应h(t);(2)绘出该系统的单位阶跃响应g(t);(3)若该系统输入输入信号x(t)=e-3tu(t
11、),绘出此时系统的零状态响应波形。解:a=1 4 3;b=0 1 2;subplot(2,2,1)impulse(b,a)subplot(2,2,2)step(b,a)clf;a=1 4 3;b=0 1 2;p1=0.6;t1=0:p1:5;p2=0.3;t2=0:p2:5;p3=0.005;t3=0:p3:5;x1=exp(-3*t1);x2=exp(-3*t2);x3=exp(-3*t3);lsim(b,a,x1,t1)text(0.5,-0.2,p=0.6,color,0 0 1)hold onlsim(b,a,x2,t2)text(1.5,-0.02,p=0.3,color,0 0.7
12、 0)lsim(b,a,x3,t3)text(0.01,-0.08,p=0.01,color,1 0 0)hold offgrid on2.1.5已知描述某离散系统的差分方程如下:y(k)-3y(k-1)+2y(k-3)=x(k-1)+2x(k-2)且知该系统的的输入序列为x(k)=(1/4)ku(k),试用MATLAB分析在020时间内的下列过程:(1)绘出输入序列的时域波形;(2)求出该系统输入序列为x(k)时的零状态响应样值;(3)绘出该系统输入序列为x(k)时的零状态响应时域波形。解:a=1 -3 0 2;b=0 1 2 0;k=0:20;x=(1/4).k;dk=zeros(1,le
13、ngth(k);dk(1)=1;uk=ones(1,length(k);subplot(4,1,1)stem(k,x)title(输入序列x(k)ydk=filter(b,a,dk);subplot(4,1,2)stem(k,ydk)title(单位冲击响应)yuk=filter(b,a,uk);subplot(4,1,3)stem(k,yuk)title(单位阶跃响应)y=filter(b,a,x);subplot(4,1,4)stem(k,y)title(激励信号为x(k)的零状态响应)第3章 连续系统的频域分析方法3.1自定义函数3.1.1第1个自定义函数利用MATLAB实现f(t)=te-2tu(t)傅里叶变换,绘出其振幅谱和相位谱。解:syms t w ff=t*exp(-2*t)*sym(Heaviside(t);F=fourier(f)omiga=-10:10;subplot(2,1,1);ezplot(abs(F),-10:10);title(振幅谱)subplot(2,1,2);plot(omiga,angle(subs(F,w,omiga)title(相位谱)3.1.2利用MATLAB实现F(jw)=-j*2w/(42+w2)的傅里叶变换并绘出其波形。解:syms t w F=-j*2*w/(42
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1