信号与系统上机实验-matlab(第一第二次实验课)

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

实验一典型连续时间信号描述及运算一、典型连续时间信号绘制1、单边指数衰减t=0:1:500;f1=200*exp(-1.*t./62.5);f2=200*exp(-1.*t./125.0);f3=200*exp(-1.*t./250.0);plot(t,f1,'-',t,f2,'--',t,f3,'-.')0501001502002503003504004505000204060801001201401601802002、正弦信号t=-250:1:250;pi=3.1415926f1=150*sin(2*pi*t/100);f2=150*sin(2*pi*t/200);f3=150*sin(2*pi*t/200+pi/5);plot(t,f1,'-',t,f2,'--',t,f3,'-')-250-200-150-100-50050100150200250-150-100-500501001503、正弦衰减信号t=0:1:500;f1=200*sin(((2*pi*t)/100)).*exp(-t/250);plot(t,f1)050100150200250300350400450500-150-100-500501001502004、钟形信号t=-250:1:250;f1=400*exp((-t.*t)./(100*100));f2=400*exp((-t.*t)./(150*150));f3=400*exp((-t.*t)./(250*250));plot(t,f1,'-',t,f2,'--',t,f3,'-.')-250-200-150-100-500501001502002500501001502002503003504005、符号信号t=-5:0.001:5;f1=sign(t);plot(t,f1)-5-4-3-2-1012345-1-0.8-0.6-0.4-0.200.20.40.60.816、阶跃信号t=-5:0.001:5;f1=0.5+0.5*sign(t);plot(t,f1)-5-4-3-2-101234500.10.20.30.40.50.60.70.80.91二、连续时间信号的运算已知)]4()()[4()(1tututtf及信号)2sin()(2ttf,用MATLAB绘出满足下列要求的信号波形。(1))()()(113tftftf(2))]()2([)(114tftftf(3))()()(325tftftf(4))()()(216tftftf(5))()2()(267tftftf(1):symstf1=sym('(-t+4)*(heaviside(t)-heaviside(t-4))');subplot(1,2,1);ezplot(f1);y1=subs(f1,t,-t);f3=f1+y1;subplot(1,2,2);ezplot(f3);(2)symstf1=sym('(-t+4)*(heaviside(t)-heaviside(t-4))');subplot(1,2,1);ezplot(f1);y2=subs(f1,-2*t);f4=-(y2+f1);subplot(1,2,2);ezplot(f4);00.511.522.533.5400.511.522.533.54t(-t+4)(u(t)-u(t-4))-2-101234-4-3.5-3-2.5-2-1.5-1-0.50t-(2t+4)(u(-2t)-u(-2t-4))-(-t+4)(u(t)-u(t-4))(3)symstf2=sym('sin(2*pi*t)');subplot(1,3,1);ezplot(f2);subplot(1,3,2);00.511.522.533.5400.511.522.533.54t(-t+4)(u(t)-u(t-4))-4-3-2-10123400.511.522.533.54t(-t+4)(u(t)-u(t-4))+(t+4)(u(-t)-u(-t-4))ezplot(f3);f5=f2*f3;subplot(1,3,3);-6-4-20246-1-0.500.51tsin(2t)-4-202400.511.522.533.54t(-t+4)(u(t)-u(t-4))+(t+4)(u(-t)-u(-t-4))-4-2024-4-3-2-101234tsin(2t)((-t+4)(u(t)-u(t-4))+(t+4)(u(-t)-u(-t-4)))(4)symstsubplot(1,3,1);ezplot(f1);subplot(1,3,2);ezplot(f2);f6=f1*f2;subplot(1,3,3);ezplot(f6)0123400.511.522.533.54t(-t+4)(u(t)-u(t-4))-6-4-20246-1-0.500.51tsin(2t)01234-3-2-101234t(-t+4)(u(t)-u(t-4))sin(2t)(5)symsty3=subs(f6,t-2);f7=y3*f2;subplot(1,1,1);ezplot(f7)22.533.544.555.500.511.522.533.54t(-t+6)(u(t-2)-u(t-6))sin(2(t-2))sin(2t)程序随堂测试:以f(t)为三角信号为例,求f(2t),f(2-2t)t=-3:0.001:3;ft=tripuls(t,4,0.5);subplot(3,1,1);plot(t,ft);gridon;title('f(t)');ft1=tripuls(2*t,4,0.5);subplot(3,1,2);plot(t,ft1);gridon;title('f(2t)');ft2=tripuls(2-2*t,4,0.5);subplot(3,1,3);plot(t,ft2);gridon;实验二线性系统时域分析一、连续时间信号卷积利用MATLAB实现下述两个信号的卷积积分:p=0.01;k1=-0.5:p:1;f1=1;k2=0:p:2;f2=0.5*k2;[f,k]=sconv(f1,f2,k1,k2,p)这里需要创建函数sconv二、线性系统时域分析1、连续系统的冲激响应、阶跃响应及MATLAB实现(3)实验内容21110f2(t)1f1(t)t02t求解如下LTI系统的冲激响应、阶跃响应)()(8)()(2tetrtrtra=[218];b=[001];x=0:0.1:30;y=impulse(b,a,x);z=step(b,a,x);plot(x,y,'r',x,z,'b--')2、LTI连续系统的求解(3)实验内容已知描述系统的微分方程和激励信号如下)()(),(3)()(4)(4)(tuetetetetrtrtrt要求:(a)用解析法求系统的零状态响应)(tr;(b)用MATLAB绘出系统零状态响应的时域仿真波形,验证(a)求解结果是否正确。a=[244];b=[13];t=0:0.01:5;x=exp(-1*t);lsim(b,a,x,t);y=lsim(b,a,x,t);plot(t,x,t,y)例题:离散信号的卷积和两个有限长序列f1,f2卷积可调用MATLAB函数conv,调用格式是f=conv(f1,f2),f是卷积结果,但不显示时间序号,可自编一个函数dconv给出f和k,并画图。function[f,k]=dconv(f1,f2,k1,k2)%Thefunctionofcomputef=f1*f2%f:卷积和序列f(k)对应的非零样值向量%k:序列f(k)的对应序号向量%f1:序列f1(k)非零样值向量%f2:序列f2(k)的非零样值向量%k1:序列f1(k)的对应序号向量%k2:序列f2(k)的对应序号向量f=conv(f1,f2)%计算序列f1与f2的卷积和fk0=k1(1)+k2(1);%计算序列f非零样值的起点位置k3=length(f1)+length(f2)-2;%计算卷积和f的非零样值的宽度k=k0:k0+k3%确定卷积和f非零样值的序号向量subplot(2,2,1)stem(k1,f1)%在子图1绘序列f1(k)时域波形图title('f1(k)')xlabel('k')ylabel('f1(k)')subplot(2,2,2)stem(k2,f2)%在图2绘序列f2(k)时波形图title('f1(k)')xlabel('k')ylabel('f2(k)')subplot(2,2,3)stem(k,f);%在子图3绘序列f(k)的波形图title('f(k)f1(k)与f2(k)的卷积和f(k)')xlabel('k')ylabel('f(k)')h=get(gca,'position');h(3)=2.5*h(3);set(gca,'position',h)%将第三个子图的横坐标范围扩为原来的2.5倍随堂测试题:求卷积和,)1()(2)1()(1kkkkf)2()1()()1()2()(2kkkkkkf

1 / 13
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功