资源描述:
《信号与系统实验答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、%Q1_2clear,%Clearallvariablescloseall,%Closeallfigurewindowsdt=0.01;%Specifythestepoftimevariablet=0:dt:2;%Specifytheintervaloftimex=exp(-2*t);%Generatethesignalplot(t,x)%Openafigurewindowanddrawtheplotofx(t)title('Sinusoidalsignalx(t)')xlabel('Timet(sec)')axis([0,2,0,5])gridon>>%Q1_3clear,%Cl
2、earallvariablescloseall,%Closeallfigurewindowsdt=0.01;%Specifythestepoftimevariablet=0:dt:2;%Specifytheintervaloftimex=input('请输入任意信号x(t)');%Generatethesignalgridonplot(t,x)%Openafigurewindowanddrawtheplotofx(t)title('Sinusoidalsignalx(t)')xlabel('Timet(sec)')请输入任意信号x(t)exp(-2*t)Q1-4抄写函数文件delt
3、a如下:functiony=delta(t)dt=0.01;y=(u(t)-u(t-dt))/dt;抄写函数文件u如下:%Unitstepfunctionfunctiony=u(t)y=(t>=0);%y=1fort>0,elsey=0%Q1_5clear,%Clearallvariablescloseall,%Closeallfigurewindowsn=-5:5;%Specifytheintervaloftimex=[zeros(1,4),0.1,1.1,-1.2,0,1.3,zeros(1,2)];%Generatethesequencestem(n,x,'.')%Opena
4、figurewindowanddrawtheplotofx[n]gridon,axis([-2,5,-1.5,1.5])%Q1_6clear,%Clearallvariablescloseall,%Closeallfigurewindowsn=-5:5;%Specifytheintervaloftimex=0.5.^abs(n);%Generatethesequencet=-2:0.01:5;y=cos(2*pi*t).*[u(t)-u(t-3)];subplot(2,1,1),stem(n,x,'.');%Openafigurewindowanddrawtheplotofx[n]
5、gridon;title('Adiscrete-timesequencex[n]')xlabel('Timeindexn')subplot(2,1,2),plot(t,y);%Q1_7clear,%Clearallvariablescloseall,%Closeallfigurewindowsdt=0.01;%Specifythestepoftimevariablet=-5:dt:5;%Specifytheintervaloftimex=exp(-0.5*t).*u(t);%Generatethesignaly=exp(-0.75*t-1.5).*u(1.5*t+3);subplo
6、t(2,1,1),plot(t,x);%Openafigurewindowanddrawtheplotofx(t)gridon;title('Sinusoidalsignalx(t)');xlabel('Timet(sec)');subplot(2,1,2),plot(t,y);gridon;title('Sinusoidalsignaly(t)');xlabel('Timet(sec)');%Q1_8clear,closeall,n=-20:20;x=u(n)-u(n-8);%Generatetheoriginalsignalx(t)x1=u(n+6)-u(n-2);%Shift
7、x(t)totheleftby2secondtogetx1(t)x2=u(n-6)-u(n-14);%Shiftx(t)totherightby2secondtogetx2(t)subplot(311),stem(n,x);%Plotx(t)gridon;title('Originalsignalx(n)');subplot(312),stem(n,x1);%Plotx1(t)gridon;title('Leftshiftedversionofx(n)');subpl