实验一-信号和系统时域分析(matlab).docxVIP

  • 13
  • 0
  • 约6.67千字
  • 约 18页
  • 2018-06-28 发布于福建
  • 举报
实验一 信号与系统的时域分析(matlab)1 信号的产生产生冲击信号程序:%t1=input(please input the start time t1=’) % 时间起点%t2=input(please input the end time t2=’) % 时间终点t1=-2;t2=2;t0=0;dt=0.01;t=t1:dt:t2;n=length(t);x=zeros(1,n);x(1 ,(-t0-t1)/dt+1)=100;stairs(t,x);axis([t1 t2 -5 1.2/dt])title(单位冲击信号δ(t)))图像:(2)阶跃信号程序:t=t1:0.01:-t0; %t0 时刻前时间样本向量tt=t0:0.01:t2; %0 时刻后时间样本向量n=length(t); %t0 前时间样本点向量长度nn=length(tt); %t0 后样本点向量长度u=zeros(1,n); %t0 前各样本点信号值赋值为零uu=ones(1,nn); %t0 后各样本点信号值赋值为一plot(tt,uu) %绘出 t0 时刻后波形hold on 允许在同一坐标系中添加图形plot(t,u) %绘出 t0 时刻前波形plot([-t0,-t0],[0,1]) %添加直线hold off %关闭添加命令title(单位阶跃信号) %图形标题axis([t1,t2 ,-0.2,1.5]) %限制坐标范围图像:(3)实指数信号程序:f= str2sym(exp(a*t));f1=subs(f,a,-1);figuresubplot(221)ezplot(f1,[-2,2]);f2=subs(f,a,1);subplot(222)ezplot(f2,[-2,2])f3=subs(f,a,0);subplot(223)ezplot(f3,[-2,2])图像:(4)虚指数信号程序:n1=input(输入绘制波形的起始时间 n1= );n2=input(输入绘制波形的终止时间 n2= );w=input(虚指数信号角频率 w= );a=input(虚指数信号幅度 a= );t=n1:0.01:n2;X=a*exp(1i*w*t);Xr=real(X);Xi=imag(X);Xa=abs(X);Xn=angle(X);figuresubplot(2,2,1);plot(t,Xr)axis([n1,n2,-(max(Xa)+0.5),max(Xa)+0.5])title(实部);subplot(2,2,3),plot(t,Xi)axis([n1,n2,-(max(Xa)+0.5),max(Xa)+0.5])title(虚部);subplot(2,2,2)plot(t,Xa)axis([n1,n2,0,max(Xa)+1]),title(模);subplot(2,2,4),plot(t,Xn)axis([n1,n2,-(max(Xn)+1),max(Xn)+1]),title(相角);图像:(5)复指数信号程序:t=0:0.01:3;a=-2;b=10;z=exp((a+i*b)*t);subplot(2,2,1);plot(t,real(z));title(实部);subplot(2,2,2);plot(t,imag(z));title(虚部);subplot(2,2,3);plot(t,abs(z));title(模);subplot(2,2,4);plot(t,angle(z));title(相角);图像:(6)产生冲击序列程序:k=k1:k2;n=length(k);f=zeros(1,n)f(1,-k0-k1+1)=1;stem(k,f,filled)axis([k1,k2 0,1.5])title(单位序列δ(k))图像:(7)阶跃序列程序:%k1=input(please input the start time k1=); % 序列起点% k2=input(please input the end time k2=); % 序列终点k1=-4;k2=6;k0=0;k=k1:-k0-1;kk=k0:k2;n=length(k);nn=length(kk);u=zeros(1,n)

文档评论(0)

1亿VIP精品文档

相关文档