南通大学电子信息学院信号与系统课程设计报告2014—2015学年第一学期班级:姓名:学号:指导老师:设计时间:1一、连续信号的时域分析二、1.信号的产生(1)阶跃函数function[t,y1]=jieyue(t1,t2,t0)dt=0.01;ttt=t1:dt:t0-dt;tt=t0:dt:t2;t=t1:dt:t2;n=length(ttt);nn=length(tt);u=zeros(1,n);uu=ones(1,nn);y1=[u,uu];return冲激函数function[t,y2]=chongji(t1,t2,t0)dt=0.01;t=t1:dt:t2;n=length(t);y2(1:n)=0;y2(1,(t0-t1)/dt+1)=1/dt;(2)调用上述函数产生信号)2-tε(,)(4-t,-te)(t,-6s≤t≤6s,并画出波形。CommandWindowsubplot(3,1,1);[t1,y1]=jieyue(-6,6,2);2stairs(t1,y1);axis([-6601.5]);subplot(3,1,2);[t2,y2]=chongji(-6,6,4);plot(t2,y2);subplot(3,1,3);[t3,y3]=jieyue(-6,6,0);y3=exp(-(t3)).*y3;plot(t3,y3);波形如下图所示:(3)根据f(t)画出f(2t)和f(1-0.5t)的波形t=-3:0.01:3;y=tripuls(t,4,0.6);subplot(3,1,1);plot(t,y);3title('f(t)');xlabel('(a)');y1=tripuls(2*t,4,0.6);subplot(3,1,2);plot(t,y1);title('f(2t)');xlabel('(b)');t1=2-2*t;y2=tripuls(1-0.5*t1,4,0.6);subplot(3,1,3);plot(t1,y2);title('f(1-0.5*t)');xlabel('(c)');得到波形如下图所示:4已知信号f(t)=(1+t/2)*(u(t+2)-u(t-2)),用matlab求f(t+2),f(t-2),f(-t).f(2t),-f(t),并绘出时域波形。CommandWindowsymst;f=sym(‘(t/2+1)*(Heaviside(t+2)-Heaviside(t-2))’);subplot(2,3,1);ezplot(f,[-3,3]);y1=subs(f,t,t+2);subplot(2,3,2);ezplot(y1,[-5,1]);y2=subs(f,t,t-2);subplot(2,3,3);ezplot(y2,[-1,5]);y3=subs(f,t,-t);subplot(2,3,4);ezplot(y3,[-3,3]);y4=subs(f,t,2*t);subplot(2,3,5);ezplot(y4,[-2,2]);y5=-f;subplot(2,3,6);ezplot(y5,[-3,3]);仿真结果如下图所示:52、信号的卷积(1)f(t)=f1(t)*f2(t)function[k,f]=myconv(f1,f2,k1,k2,p)f=conv(f1,f2)*p;k0=k1(1)+k2(1);k3=length(f1)+length(f2)-2;k=k0:p:k0+k3*p;(2)求x1=)()(2-t-tet和x2=δ(t+3)+δ(t-3)的卷积x1(t)*x2(t),并验证卷积的性质。CommandWindow[t1,f11]=jieyue(-8,8,0);[t1,f12]=jieyue(-8,8,2);f1=f11-f12;x1=exp(-t1).*f1;[t2,f21]=chongji(-8,8,-3);[t2,f22]=chongji(-8,8,3);6x2=f21+f22;subplot(3,1,1);plot(t1,x1);subplot(3,1,2);plot(t2,x2);[t3,f]=myconv(x1,x2,t1,t2,0.01)subplot(3,1,3);plot(t3,f);仿真结果:(3)已知32,120,1tf1tt)(,t22etf)(,0=t=10的卷积f(t)=f1(t)*f2(t)的时域波形图。CommandWindowt11=0;t12=3;t21=0;t22=10;t1=t11:0.001:t12;7ft1=-sign(t1-2);t2=t21:0.001:t22;ft2=exp(-2*t2);t=t11+t21:0.001:t12+t22;ft=conv(ft1,ft2);ft=ft*0.001;subplot(2,2,1);plot(t1,ft1);title('f1(t)');subplot(2,2,2);plot(t2,ft2);title('f2(t)');subplot(2,2,3);plot(t,ft);title('f1(t)*f2(t)');仿真结果:8例:已知两个信号f1(t)=u(t-1)-u(t-2),f2(t)=u(t)-u(t-1),求f(t)=f1(t)*f2(t)的时域波形图。CommandWindowt1=1;t2=2;t3=0;t4=1;t=0:T:t2+t4;x1=ones(size(t)).*((tt1)-(tt2));x2=ones(size(t)).*((tt3)-(tt4));y=conv(x1,x2)*T;subplot(3,1,1),plot(t,x1);ylabel('x1(t)');subplot(3,1,2),plot(t,x2);ylabel('x2(t)');subplot(3,1,3),plot(t,y(1:(t2+t4)/T+1));ylabel('y(t)=x1*x2');xlable('---t/s');仿真结果:93.连续系统的响应(1)已知系统的微分方程为y''(t)+5y'(t)+6y(t)=f(t),求系统的单位冲激响应h(t)和单位阶跃响应g(t);CommandWindowb=[1];a=[1,5,6];subplot(2,1,1);impulse(b,a);subplot(2,1,2);step(b,a);仿真结果:10(2)对于上述系统,请画出激励f(t)分别为)(te-t、)(te-2t、)()(tt2cos、)(tt2时系统的零状态响应的波形,分析与理论计算的结果是否相符。CommandWindowb=[1];a=[1,5,6];t=0:0.1:10;f1=exp(-t);f2=cos(2*t);f3=t.^2;f4=(exp(-2*t));subplot(2,2,1);lsim(b,a,f1,t);grid;title('f(t)=exp(-t)');subplot(2,2,2);lsim(b,a,f2,t);grid;title('f(t)=cos(2*t)');subplot(2,2,3);lsim(b,a,f3,t);grid;title('f(t)=t.^2');subplot(2,2,4);lsim(b,a,f4,t);grid;title('f(t)=exp(-2*t)');11仿真结果:(3)已知系统的微分方程为y’’(t)+3y’(t)+2y(t)=3f(t)+f’(t),初始条件:y(0+)=1,y’(0-)=2,求:1)系统的零输入响应)(tyx;2)激励为f(t)=)(te-3t时,系统的零状态响应)(tyf和全响应y(t),分析与理论计算的结果是否相符。12二.离散系统的时域分析(1)已知离散系统的差分方程为:y(k)+1/3y(k-2)=1/6f(k)+1/2f(k-1)+1/2f(k-2)+1/6f(k-3),画出单位序列响应、单位阶跃响应的波形。CommandWindowk=0:1:32;a=[1,0,1/3,0];b=[1/6,1/2,1/2,1/6];subplot(2,1,1);hk=impz(b,a,k);stem(k,hk,'k');subplot(2,1,2);gk=dstep(b,a,k);stem(k,gk,'r');仿真结果:(2)已知离散系统的差分方程为:y(k)-1.5y(k-1)+0.5y(k-2)=f(k)满足初始条件y(-1)=4,y(-2)=10,13用filtic和filter子函数求系统的激励为f(k)=(0.25)^k*u(k)时的零输入、零状态以及完全响应。CommandWindowa=[1,-1.5,0.5];b=[1];N=20;k=0:N-1;f=0.25.^k;f0=zeros(1,N);y01=[4,10];fi=filtic(b,a,y01);y0=filter(b,a,f0,fi);fi0=filtic(b,a,0);y1=filter(b,a,f,fi0);y=filter(b,a,f,fi);y2=((1/2).^k+1/3*(1/4).^k+2/3).*ones(1,N);subplot(2,3,1);stem(k,f);title('输入信号f(k)');subplot(2,3,2);stem(k,y0);title('零输入响应');subplot(2,3,3);stem(k,y1);title('零状态响应');subplot(2,3,4);stem(k,y);title('用filter求完全响应');subplot(2,3,5);stem(k,y2);title('用公式求完全响应');仿真结果:14(3)已知离散系统的差分方程为y(k)+3y(k-1)+2y(k-2)=f(k),(a)画出单位阶跃响应、单位序列响应的波形;(b)画出激励)()(k2kfk时的系统零状态响应波形。CommandWindown=0:1:100;a=[1,3,2];b=[1,0,0];subplot(3,1,1);hn=impz(b,a,n);stem(n,hn,'k');subplot(3,1,2);gn=dstep(b,a,n);stem(n,gn,'r');f2=2.^n;subplot(3,1,3);y2=filter(b,a,f2);plot(n,y2,'.');仿真结果:1516三.信号与系统的频域分析1、门函数的频谱(1)产生宽度为的门函数)(tg,画出=10秒时门函数在-2(rad/s)=w=2π(rad/s)频率范围内频谱,记录最大值,观察第一过零点位置:CommandWindowdt=0.1;N=500;door_width=10;tao=door_width/2;t1=-(N-dt):dt:-tao+dt;t2=-tao:dt:tao;t3=tao+dt:dt:N-dt;t=[t1,t2,t3];f=[zeros(1,length(t1)),ones(1,length(t2)),zeros(1,length(t3))];w=-2*pi:0.1:2*pi;F1=f*exp(-j*t'*w)*dt;plot(w,real(F1));grid;仿真结果:17(2)改变的值为5秒和20秒,重复(1)步骤;5202、傅里叶变换及其性质的验证(1)求f(t)=t2e的傅里叶变换,并绘出f(t)及其傅里叶变换的波形图。CommandWindowsymst;18ft=exp(-2*abs(t));Fw=fourier(ft);subplot(2,1,1);ezplot(ft);subplot(2,1,2);ezplot(Fw);仿真结果:(2)以门函数)(tg为分析对象,验证傅里叶变换的时移性质、频移性质;时移性质:CommandWindowdt=0.1;N=500;door__width=10;tao=door__width/2;