收藏 分销(赏)

《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc

上传人:精**** 文档编号:1714754 上传时间:2024-05-08 格式:DOC 页数:40 大小:828.03KB
下载 相关 举报
《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc_第1页
第1页 / 共40页
《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc_第2页
第2页 / 共40页
《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc_第3页
第3页 / 共40页
《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc_第4页
第4页 / 共40页
《基于MATLAB的信号与系统实验指导》编程练习试题(wor.doc_第5页
第5页 / 共40页
点击查看更多>>
资源描述

1、专业资料2连续时间信号在MATLAB中的表示2-1.利用MATLAB命令画出下列连续信号的波形图(1) t=0:0.01:3; ft=2*cos(3*t+pi/4); plot(t,ft),grid on; axis(0 3 -2.2 2.2); title(2cos(3t+pi/4)(2) t=0:0.01:3; ft=2-exp(-t); plot(t,ft),grid on; title(2-exp(-t)u(t)(3) t=-1:0.01:1; ft=t.*(uCT(t)-uCT(t-1); plot(t,ft),grid on axis(-1 1 -0.2 1.2); title(t

2、u(t)-u(t-1)(4) t=-1:0.01:3; ft=(1+cos(pi*t).*(uCT(t)-uCT(t-2); plot(t,ft),grid on axis(-1 3 -0.2 2.2); title(1+cos(pi*t)u(t)-u(t-2)2-2.利用MATLAB命令画出下列复信号的实部、虚部、模和辐角(1) t=0:0.01:3; ft=2+exp(i*(pi/4)*t)+exp(i*(pi/2)*t); subplot(2,2,1);plot(t,real(ft);title(实部);axis(0 3 0 4);grid on; subplot(2,2,2);plot

3、(t,imag(ft);title(虚部);axis(0 3 0 2);grid on; subplot(2,2,3);plot(t,abs(ft);title(模);axis(0 3 0 4);grid on; subplot(2,2,4);plot(t,angle(ft);title(相角);axis(0 3 0 2);grid on;(2)t=0:0.01:3; ft=2*exp(i*(t+pi/4); subplot(2,2,1);plot(t,real(ft);title(实部);axis(0 3 0 2);grid on; subplot(2,2,2);plot(t,imag(ft

4、);title(虚部);axis(0 3 0 2);grid on; subplot(2,2,3);plot(t,abs(ft);title(模);axis(0 3 0 4);grid on; subplot(2,2,4);plot(t,angle(ft);title(相角);axis(0 3 0 4);grid on;2-3.利用MATLAB命令产生幅度为1、周期为1、占空比为0.5的一个周期矩形脉冲信号 t=-0.5:0.01:3; ft=square(2*pi*t,50); plot(t,ft);grid on;axis(-0.5 3 -1.2 1.2); title(幅度为1、周期为1

5、、占空比0.5的周期举行脉冲信号)3连续时间信号在MATLAB中的运算3-1.试用MATLAB命令绘出以下信号的波形图(1) syms x t; t=-1:0.01:1; x=exp(-t).*sin(10*pi*t)+exp(-0.5*t).*sin(9*pi*t); plot(t,x)(2) syms x t; t=-1:0.01:1; x=sinc(t).*cos(10*pi*t); plot(t,x)3-2.已知连续时间信号f(t)的波形如图3-6所示,试用MATLAB命令画出下列信号的波形图先画出图3-6: t=-2:0.01:2;f=(-t-1).*(-uCT(t+2)+uCT(t

6、+1)+uCT(t+1)+uCT(t)-uCT(t-1)-(t-1).*(uCT(t-1)-uCT(t-2)-uCT(t-2); plot(t,f) axis(-4 4 -1 2) title(图3-6) t=-2:0.01:2; f1=funct2(t-1); f2=funct2(2-t); f3=funct2(2*t+1); f4=funct2(4-t/2); f5=(funct2(t)+funct2(-t).*uCT(t); subplot(231);plot(t,f1);grid on;title(f(t-1);axis(-3 3 -1 2); subplot(232);plot(t,

7、f2);grid on;title(f(2-t);axis(-3 3 -1 2); subplot(233);plot(t,f3);grid on;title(f(2t-1);axis(-3 3 -1 2); subplot(234);plot(t,f4);grid on;title(f(4-t/2);axis(-3 3 -1 2); subplot(235);plot(t,f5);grid on;title(f(t)+f(-t)u(t);axis(-3 3 -1 2);3-3.试用MATLAB命令绘出如图3-7所示信号的偶分量和奇分量 t=0:0.01:2; f=(uCT(t)-uCT(t-

8、2).*(-t+1); plot(t,f);title(图3-7) f1=fliplr(f); fe=(f+f1)/2;fo=(f-f1)/2; subplot(211),plot(t,fe);grid on title(fe) subplot(212),plot(t,fo);grid on;title(fo)4连续时间信号的卷积计算4-1用MATLAB命令绘出下列信号的卷积积分f1t*f2(t)的时域波形图 dt=0.001;t1=-0.5:dt:3.5; f1=uCT(t1)-uCT(t1-2); t2=t1; f2=uCT(t2)+uCT(t2-1)-uCT(t2-2)-uCT(t2-3

9、); t,f=ctsconv(f1,f2,t1,t2,dt);6周期信号的傅里叶级数及频谱分析6-1已知周期三角信号如图6-5所示,试求出该信号的傅里叶级数,利用MATLAB编程实现其各次谐波的叠加,并验证其收敛性。6-2 试用MATLAB分析图6-5中周期三角信号的频谱。当周期三角信号的周期和三角信号的宽度变化时,试观察分析其频谱的变化。7 傅里叶变换及其性质7-1试用MATLAB命令求下列信号的傅里叶变换,并绘出其幅度谱和相位谱。(1)f1t=sin2(t-1)(t-1) (2)f2t=sin(t)t2解:(1)ft1=sym(sin(2*pi*(t-1)/(pi*(t-1); Fw1=s

10、implify(fourier(ft1); subplot(211) ezplot(abs(Fw1),grid on title(幅度谱) phase=atan(imag(Fw1)/real(Fw1); subplot(212) ezplot(phase);grid on title(相位谱)(2)7-2.试用MATLAB命令求下列信号的傅里叶反变换,并绘出其时域信号图。(1)F1w=103+wi-45+wi (2)F2w=e-4w2解:(1) syms t Fw=sym(10/(3+w*i)-4/(5+w*i); ft=ifourier(Fw,t); ezplot(ft),grid on(2

11、) syms t Fw2=sym(exp(-4*w2); ft2=ifourier(Fw2,t) ft2 = exp(-t2/16)/(4*pi(1/2)3.试用MATLAB数值计算方法求图7-8所示信号的傅里叶变换,并画出其频谱图。解:4.已知两个门信号的卷积为三角波信号,试用MATLAB命令验证傅里叶变换的时域卷积定理。解:将门函数先进行时域卷积运算,再将卷积后的结果做傅里叶变换,程序和结果如下:dt=0.01;t=-2:dt:2.5;f1=uCT(t+0.5)-uCT(t-0.5);f=conv(f1,f1)*dt;ft=sym(f);Fw=fourier(ft)Fw=2*i*pi*di

12、rac(1,w)将一个门函数先进行傅里叶变换,再将结果与自身相乘,程序和结果如下:dt=0.01;t=-2:dt:2.5;f1=uCT(t+0.5)-uCT(t-0.5);ft=sym(f1);Fw=fourier(ft);Fw=Fw*FwFw=-4*pi2*dirac(1,w)2由此来验证傅里叶变换的时域卷积定理第8章 连续时间LTI系统的频率特性及频域分析8.1试用MATLAB命令求图8-8所示电路系统的幅频特性和相频特性。已知R=10,L=2H,C=0.1F解:由电路知识可得,该电路系统的频率响应为H=j0.2(j)3+0.2(j)2+jMATLAB源程序: w=-6*pi:0.01:6

13、*pi; b=1 0; a=0.2 0.2 1 0; H=freqs(b,a,w); subplot(211) plot(w,abs(H),grid on xlabel(omega(rad/s),ylabel(|H(omega)|) title(电路系统的幅频特性) subplot(212) plot(w,angle(H),grid on xlabel(omega(rad/s),ylabel(phi(omega) title(电路系统的相频特性)8.2已知系统微分方程和激励信号如下,试用MATLAB命令求系统的稳态响应。(1)dy(t)dt+32yt=df(t)dt,ft=cos2t;(2)d

14、2y(t)dt2+2dy(t)dt+3yt=-dftdt+2f(t),ft=3+cos2t+cos5t。解:(1)频率响应为H=jj+32 t=0:0.01:20; H=(w*i)/(w*i+3/2); f=cos(2*t); y=abs(H)*cos(2*t+angle(H); subplot(211) plot(t,f),grid on ylabel(f(t),xlabel(Time(s) title(激励信号的波形) subplot(212) plot(t,y),grid on ylabel(y(t),xlabel(Time(s) title(稳态响应的波形)(2)频率响应为H=-j+2

15、(j)2+2j+3MATLAB源程序: t=0:0.01:20; w1=2;w2=5; H1=(-i*w1+2)./(i*w1)2+2*i*w1+3); H2=(-i*w2+2)./(i*w2)2+2*i*w2+3); f=3+cos(2*t)+cos(5*t); y=3+abs(H1)*cos(w1*t+angle(H1)+abs(H2)*cos(w2*t+angle(H2); subplot(211); plot(t,f);grid on ylabel(f(t),xlabel(Time(s) title(激励信号的波形) subplot(212); plot(t,y),grid on yl

16、abel(y(t),xlabel(Time(s) title(稳态响应的波形)第9章 信号抽样及抽样定理9.1设有三个不同频率的正弦信号,频率分别为f1=100Hz,f2=200Hz,f3=3800Hz。现在用抽样频率fs=4000Hz对这三个正弦信号进行抽样,用MATLAB命令画出各抽样信号的波形及其频谱,并分析其频率混叠现象。解: Ts=0.00025; dt=0.0001; t1=-0.1:dt:0.1; ft=sin(200*pi*t1); subplot(221) plot(t1,ft),grid on axis(-0.01 0.01 -1.1 1.1) xlabel(Time(se

17、c),ylabel(f(t) title(f1信号) N=100; k=-N:N; W=pi*k/(N*dt); Fw=ft*exp(-i*t1*W)*dt; subplot(222) plot(W,abs(Fw),grid on axis(-5000 5000 -0.1 0.2) t2=-0.1:Ts:0.1; fst=sin(200*pi*t2); subplot(223) plot(t1,ft,:),hold on stem(t2,fst),grid on axis(-0.01 0.01 -1.1 1.1) xlabel(Time(sec),ylabel(fs(t) title(抽样后的

18、信号),hold off Fsw=fst*exp(-i*t2*W)*Ts; subplot(224) plot(W,abs(Fsw),grid on axis(-5000 5000 -0.1 0.2) xlabel(omega),ylabel(Fs(w) title(抽样信号的频谱)9.2结合抽样定理,用MATLAB编程实现Sa(t)信号经冲激脉冲抽样后得到的抽样信号fs(t)及其频谱,并利用fs(t)重构Sa(t)信号。解:首先,画出Sa(t)信号的波形和频谱: syms t; Sa(t)=(sin(t)/t; subplot(211) ezplot(Sa(t),grid on xlabel

19、(Time(sec),ylabel(Sa(t) title(Sa(t)的波形) Fw=simplify(fourier(Sa(t); subplot(212) ezplot(abs(Sa(t),grid on xlabel(omega),ylabel(H(jw) title(Sa(t)的频谱)由图可知,Sa(t)的频谱大部分集中在0,6之间,设其截止频率为wm=6,因而奈奎斯特间隔Ts=12fm=6,采用截止频率wc=1.2wm的低通滤波器对抽样信号滤波后重建信号f(t),并计算重建信号与原Sa(t)信号的绝对误差: wm=6; wc=1.2*wm; Ts=0.4; n=-100:100; n

20、Ts=n*Ts; fs=sinc(nTs/pi); t=-6:0.1:6; ft=Ts*wc/pi*fs*sinc(wc/pi)*(ones(length(nTs),1)*t-nTs*ones(1,length(t); t1=-6:0.1:6; f1=sinc(t1/pi); subplot(311) plot(t1,f1,:),hold on stem(nTs,fs),grid on axis(-6 6 -0.5 1) xlabel(nTs),ylabel(f(nTs); title(抽样间隔Ts=0.4时的抽样信号f(nTs) hold off subplot(312) plot(t,ft

21、),grid on axis(-6 6 -0.5 1) xlabel(t),ylabel(f(t); title(由f(nTs)信号重建得到Sa(t)信号) error=abs(ft-f1); subplot(313) plot(t,error),grid on xlabel(t),ylabel(error(t); title(重建信号与原信号的绝对误差)第10章 拉普拉斯变换10.1试用MATLAB命令求下列函数的拉普拉斯变换。(1)te-3t(2)(1+3t+5t2)e-2t解:(1) f=sym(t*exp(-3*t); L=laplace(f) L = 1/(s + 3)2(2) f=

22、sym(1+3*t+5*t2)*exp(-2*t); L=laplace(f) L = 1/(s + 2) + 3/(s + 2)2 + 10/(s + 2)310.2试用MATLAB命令求下列函数的拉普拉斯反变换。(1)12s+3(2)3(s+5)(s+2)(3)3s(s+5)(s+2)(4)1s2(s2+2s+2)解:(1) F=sym(1/(2*s+3); f=ilaplace(F) f = exp(-(3*t)/2)/2(2) F=sym(3/(s+5)*(s+2); f=ilaplace(F) f = exp(-2*t) - exp(-5*t)(3) F=sym(3*s/(s+5)*

23、(s+2); f=ilaplace(F) f = 5*exp(-5*t) - 2*exp(-2*t)(4) F=sym(1/(s2*(s2+2*s+2); f=ilaplace(F) f = t/2 + (exp(-t)*cos(t)/2 - 1/210.3已知某线性时不变系统的系统函数为Hs=4s2+4s+4s3+3s2+2s利用MATLAB的拉普拉斯变换法求系统的单位阶跃响应。解:输入信号xt=u(t)的拉普拉斯变换为Xs=1s,故Ys=Hs*Xs=4s2+4s+4s4+3s3+2s2 F=sym(4*s2+4*s+4)/(s4+3*s3+2*s2); f=ilaplace(F) f =

24、2*t + 4*exp(-t) - 3*exp(-2*t) - 1所以单位阶跃响应为yt=(2t+4e-t-3e-2t-1)u(t).第11章 连续时间LTI系统的零极点分析11.1试用MATLAB命令画出下列系统函数的零极点分布图,并判断其稳定性。(1)Hs=s(s+2)s2+8(2)Hs=s(s-2)s2+8(3)Hs=s2s2+4s+8(4)Hs=s2s2-4s+8(5)Hs=ss3-4s2+8s解:(1) b=1 2 0; a=1 0 8; sys=tf(b,a) pzmap(sys)因为极点在虚轴上,所以系统临界稳定。(2) b=1 -2 0; a=1 0 8; sys=tf(b,a

25、); pzmap(sys)系统临界稳定。(3) b=1 0 0; a=1 4 8; sys=tf(b,a); pzmap(sys)系统稳定。(4) b=1 0 0; a=1 -4 8; sys=tf(b,a); pzmap(sys)系统不稳定。(5) b=1 0; a=1 -4 8 0; sys=tf(b,a); pzmap(sys)系统不稳定。11.2试用MATLAB命令实现下列含有二阶极点的系统函数所对应的时域冲击响应的波形,并分析系统函数对时域波形的影响。(1)H1(s)=1s2(2)H2s=1(s+1)2(3)H3(s)=14s(s2+49)2解:(1) b1=1; a1=1 0 0;

26、 sys1=tf(b1,a1); subplot(121) pzmap(sys1) subplot(122) impulse(b1,a1)系统在虚轴上有二阶极点,系统不稳定。(2) b2=1; a2=1 2 1; sys2=tf(b2,a2); subplot(121) pzmap(sys2)ROC为Res-1,系统稳定。(3) b3=14 0; a3=1 0 98 0 2401; sys3=tf(b3,a3); subplot(121) pzmap(sys3) subplot(122) impulse(b3,a3) axis(0 10 -20 20)s右半平面有极点,系统不稳定。11.3已知

27、系统函数为Hs=1s2+2as+1,试用MATLAB画出a=0、14、1、2时系统的零极点分布图。如果系统是稳定的,画出系统的幅频特性曲线,并分析系统极点位置对系统的幅频特性有何影响?(提示:利用freqs函数。)解:(1)a=0时: b1=1; a1=1 0 1; sys1=tf(b1,a1); pzmap(sys1)系统是不稳定的。(2)a=14时: b2=1; a2=1 0.5 1; sys2=tf(b2,a2); subplot(121) pzmap(sys2) w=-8*pi:0.01:8*pi; H=freqs(b2,a2,w) subplot(122) plot(w,abs(H)

28、,grid on plot(w,abs(H),grid on xlabel(omega(rad/s),ylabel(|H(omega)|) axis(-10 10 0 2.5) title(H(s)=1/(s2+0.5s+1)的幅频特性)(3)a=1时: b3=1; a3=1 2 1; sys3=tf(b3,a3); subplot(121) pzmap(sys3) w=-8*pi:0.01:8*pi; H=freqs(b3,a3,w); subplot(122) plot(w,abs(H),grid on xlabel(omega(rad/s),ylabel(|H(omega)|) titl

29、e(H(s)=1/(s2+2s+1)的幅频特性)(4)a=2时: b4=1; a4=1 4 1; sys4=tf(b4,a4); subplot(121) pzmap(sys4) w=-8*pi:0.01:8*pi; H=freqs(b4,a4,w); subplot(122) plot(w,abs(H),grid on xlabel(omega(rad/s),ylabel(|H(omega)|) title(H(s)=1/(s2+4s+1)的幅频特性)综上可知,极点离虚轴距离越远,冲激响应波形变化越快,但越快稳定。第12章 离散时间信号的表示及运算12.1 试用MATLAB命令分别绘出下列各

30、序列的波形图。(1)xn=12nu(n)(2)xn=2nu(n)(3)xn=-12nu(n)(4)xn=-2nu(n)(5)xn=2n-1u(n-1)(6)xn=12n-1u(n)解: n=-10:10; x1=(0.5).n.*uDT(n); x2=2.n.*uDT(n); x3=(-0.5).n.*uDT(n); x4=(-2).n.*uDT(n); x5=2.(n-1).*uDT(n-1); x6=(0.5).(n-1).*uDT(n); subplot(321); stem(n,x1,fill),grid on title(x(n)=(1/2)nu(n),xlabel(n) subpl

31、ot(322); stem(n,x2,fill),grid on title(x(n)=(2)nu(n),xlabel(n) subplot(323); stem(n,x3,fill),grid on title(x(n)=(-1/2)nu(n),xlabel(n) subplot(324); stem(n,x4,fill),grid on title(x(n)=(-2)nu(n),xlabel(n) subplot(325); stem(n,x5,fill),grid on title(x(n)=2(n-1)u(n),xlabel(n) subplot(326); stem(n,x6,fil

32、l),grid on title(x(n)=(1/2)(n-1)u(n),xlabel(n)12.2试用MATLAB分别绘出下列各序列的波形图(1)xn=sinn5(2)xn=cosn10-5(3)xn=(56)nsin(n5)(4)xn=(32)nsin(n5)解: n=-10:10; x1=sin(n*pi/5); x2=cos(n*pi)/10-pi/5); x3=(5/6).n.*sin(n.*pi)/5); x4=(3/2).n.*sin(n.*pi)/5); subplot(221) stem(n,x1,fill),grid on title(x(n)=sin(n*pi/5),xl

33、abel(n); subplot(222); stem(n,x2,fill),grid on; title(x(n)=cos(n*pi/10-pi/5),xlabel(n); subplot(223); stem(n,x3,fill),grid on; title(x(n)=(5/6)nsin(n*pi/5),xlabel(n); subplot(224); stem(n,x4,fill),grid on; title(x(n)=(3/2)nsin(n*pi/5),xlabel(n);12 离散时间LTI系统的时域分析13.1试用MATLAB命令求解以下离散时间系统的单位取样响应。(1)3yn

34、+4yn-1+yn-2=xn+x(n-1)(2)52yn+6yn-1+10yn-2=x(n)解:(1) a=3 4 1; b=1 1; n=-5:15; x=impDT(n); y=filter(b,a,x); stem(n,y,fill),grid on xlabel(n),title(3y(n)+4y(n-1)+y(n-2)=x(n)+x(n-1)的单位取样响应)(2) a=5/2 6 10; b=1; n=0:30; impz(b,a,30),grid on xlabel(n),title(5/2y(n)+6y(n-1)+10y(n-2)=x(n)的单位取样响应)13.2已知某系统的单位

35、取样响应为hn=(78)nun-un-10,试用MATLAB求当激励信号为xn=un-u(n-5)时,系统的零状态响应。解: nx=-2:7; nh=-4:14; x=uDT(nx)-uDT(nx-5); h=(7/8).nh.*(uDT(nh)-uDT(nh-10); y=conv(x,h); ny1=nx(1)+nh(1); ny=ny1+(0:(length(nx)+length(nh)-2); subplot(311) stem(nx,x,fill),grid on xlabel(n),title(x(n); subplot(312) stem(nh,h,fill),grid on x

36、label(n),title(h(n); subplot(313) stem(ny,y,fill),grid on xlabel(n),title(y(n)=x(n)*h(n);第14章 z变换及离散时间LTI系统的z域分析14.1试用MATLAB的residuez函数,求出Xz=2z4+16z3+44z2+56z+323z4+3z3-15z2+18z-12的部分分式展开和。解: b=2 16 44 56 32; a=3 3 -15 18 -12; r,p,k=residuez(b,a)r = -0.0177 + 0.0000i 9.4914 + 0.0000i -3.0702 + 2.339

37、8i -3.0702 - 2.3398ip = -3.2361 + 0.0000i 1.2361 + 0.0000i 0.5000 + 0.8660i 0.5000 - 0.8660ik = -2.6667所以部分分式展开和为Xz=-2.6667-0.01771+3.2361z-1+9.49141-1.2361z-1-3.0702-2.3398i1-0.5+0.866iz-1-3.0702+2.3398i1-(0.5-0.866i)z-1.14.2试用MATLAB画出下列因果系统的系统函数零极点分布图,并判断系统的稳定性。(1)Hz=2z2-1.6z-0.9z3-2.5z2+1.96z-0.4

38、8(2)Hz=z-1z4-0.9z3-0.65z2+0.873z解:(1) b=2 -1.6 -0.9; a=1 -2.5 1.96 -0.48; zplane(b,a),grid on legend(零点,极点) title(零极点分布图)因为该系统有极点在单位圆之外,所以不稳定。(2) b=1 -1; a=1 -0.9 -0.65 0.873 0; zplane(b,a),grid on legend(零点,极点) title(零极点分布图)因为极点都位于单位圆内,所以系统稳定。14.3试用MATLAB绘制系统Hz=z2z2-34z+18的频率响应曲线。解: b=1 0 0; a=1 -3/4 1/8; H,w=freqz(b,a,400,whole); subplot(211) plot(w,abs(H),grid on xlabel(omega(rad/s),ylabel(幅度) title(离散系统幅频特性曲线) subplot(212) plot(w,angle(H),grid on xlabel(omega(rad/s),ylabel(相位) title(离散系统相频特性曲线) word完美格式

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服