您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > 信号与系统部分实验matlab代码-供参考
1信号与系统第三版112学期部分实验代码目录实验一常用信号的实现和时域变换部分实验答案.............................................................1实验二LTI时间系统的时域分析..........................................................................................3实验四连续信号与系统的频域分析.....................................................................................4实验七连续时间信号的采样与重构...................................................................................15实验一常用信号的实现和时域变换部分实验答案(1)tetft32sin)(1.0……………………………………………………………………………………………t=0:0.1:30;x=exp(-0.1*t).*sin(2/3*t);plot(t,x);axis([030-11]);grid;xlabel('Time(sec)');ylabel('f(t)');……………………………………………………………………………………………对上面的f(t)进行抽样f(n)=f(t)|t=nT=x(nT)就可以得到抽样信号,将上述命令里的时间增量改为1s,plot(t,x)命令改为可以得到下图。051015202530-1-0.8-0.6-0.4-0.200.20.40.60.81Time(sec)f(t)4.已知离散序列x(n)如图所示,试用Matlab编程绘出以下的离散序列波形。051015202530-1-0.8-0.6-0.4-0.200.20.40.60.81Time(sec)f(t)2(1)x(-n+3)clc;closeall;clearall;n=-3:2x=[333321];[x1,n1]=xlpy(x,n,-3);[x2,n2]=xlfz(x1,n1);subplot(311)stem(n,x,'filled');axis([min(n)-1,max(n)+1,min(x)-0.5,max(x)+0.5])subplot(312)stem(n1,x1,'filled');axis([min(n1)-1,max(n1)+1,min(x1)-0.5,max(x1)+0.5])subplot(313)stem(n2,x2,'filled');axis([min(n2)-1,max(n2)+1,min(x2)-0.5,max(x2)+0.5])-4-3-2-10123123-7-6-5-4-3-2-1012301234567123(2)x(n-3)x(n+2)clc;closeall;clearall;n=-3:2x=[333321];[x1,n1]=xlpy(x,n,3);[x2,n2]=xlpy(x,n,-2);nn=-5:5;x3=[00000x1];3x4=[x2zeros(1,5)];x=x3.*x4;subplot(311)stem(nn,x3,'filled');subplot(312)stem(nn,x4,'filled');subplot(313)stem(nn,x,'filled');-5-4-3-2-10123450123-5-4-3-2-10123450123-5-4-3-2-10123450123实验二LTI时间系统的时域分析6.对于因果和稳定的LTI系统,对于下列二阶微分方程确定其单位冲激响应是否是欠阻尼、过阻尼或临界阻尼,画出系统的h(t)和频率响应模的波特图。(1))()(4)(4)(txtytyty(2))(7)(5)(4)(5txtytyty(3))()()(20)(txtytyty(4))(31)(7)(5)(4)(5txtxtytyty……………………………………………………………………………………………clc;closeall;clearall;num=[1];den=[144];H=tf(num,den);bode(H);holdon;num=[7];den=[545];H=tf(num,den);-150-100-50050Magnitude(dB)10-210-1100101102103-180-135-90-450Phase(deg)BodeDiagramFrequency(rad/sec)4bode(H);holdon;num=[1/37];den=[545];H=tf(num,den);bode(H);……………………………………………………………………………………………实验四连续信号与系统的频域分析1.利用那个fourier函数求下列信号的傅里叶变换F(jw),并用ezplot函数绘出其幅度谱和相位谱.(1)tetft2sin)(31closeall;clearall;symstvwphaseimre;%定义变量t,v,w,phase,imref=exp(-3*abs(t))*sin(2*t);%Fw=fourier(f);subplot(311);ezplot(f);%画-2*pi到2*pi内函数axis([-0.01200.5]);subplot(312);ezplot(abs(Fw));im=imag(Fw);re=real(Fw);phase=atan(im/re);subplot(313);ezplot(phase);axis([-66-0.50.5]);00.20.40.60.811.21.41.61.8200.20.4texp(-3abs(t))sin(2t)-6-4-2024600.10.2wabs(-3i/(9+(w-2)2)+3i/(9+(w+2)2))-6-4-20246-0.500.5w-iatanh(1/2(-3i/(9+(w-2)2)+3i/(9+(w+2)2)-conj(-3i/(9+(w-2)2)+3i/(9+(w+2)2)))/(-3/2i/(9+(w-2)2)+3/2i/(9+(w+2)2)+1/2conj(-3i/(9+(w-2)2)+3i/(9+(w+2)2))))5(2))(4sin)(22tuttetftcloseall;clearall;symstvwphaseimre;%定义变量t,v,w,phase,imref=t*exp(-2*t)*sin(4*t)*sym('Heaviside(t)');%Fw=fourier(f);subplot(311);ezplot(f);subplot(312);ezplot(abs(Fw));title('幅度谱');im=imag(Fw);re=real(Fw);phase=atan(im/re);subplot(313);ezplot(phase);title('相位谱');00.511.522.53-0.100.10.2ttexp(-2t)sin(4t)Heaviside(t)-6-4-202460.040.060.080.10.120.14w幅度谱-6-4-20246-101w相位谱(3))1(2)1(2sinsin)(3tttttfcloseall;clearall;symstvwphaseimre;%定义变量t,v,w,phase,imref=sin(pi*t)/(pi*t)*(sin(2*pi*(t-1))/(2*pi*(t-1)));%Fw=fourier(f);subplot(311);ezplot(f);axis([-55-0.20.2]);subplot(312);ezplot(abs(Fw));title('幅度谱');im=imag(Fw);re=real(Fw);6phase=atan(im/re);subplot(313);ezplot(phase);title('相位谱');-5-4-3-2-1012345-0.200.2t1/2sin(t)/2/tsin(2(t-1))/(t-1)-6-4-2024600.050.10.15w幅度谱-6-4-20246-101w相位谱2.用ifourier函数求下列傅里叶变换的逆变换,并画出其时域波形。(1))4(21)(2SajFsymstwF=0.5*(sin(0.25*w)/(0.25*w))^2;f=ifourier(F,t)ezplot(f)-0.5-0.4-0.3-0.2-0.100.10.20.30.40.500.10.20.30.40.50.60.70.80.91ttHeaviside(t+1/2)-...+1/2Heaviside(-t+1/2)(2))34cos()(jFcloseallclearall;clc;symstwF=cos(4*w+pi/3);f=ifourier(F,t)ezplot(f)结果:7f=1/4*Dirac(t+4)+1/4*i*3^(1/2)*Dirac(t+4)+1/4*Dirac(t-4)-1/4*i*3^(1/2)*Dirac(t-4)无波形图定义如下Dirac冲激函数:……………………………………………………………………………………………functionf=Dirac(t)f=10*(t==0)……………………………………………………………………………………………closeallclearall;clc;symstwF=cos(4*w+pi/3);f=ifourier(F,t)ezplot(f)figure;t=-6:0.001:6;f=1/4*Dirac(t+4)+1/4*i*3^(1/2)*Dirac(t+4)+1/4*Dirac(t-4)-1/4*i*3^(1/2)*Dirac(t-4)plot(t,f);axis([-66-1111]);……………………………………………………………………………………………-6-4-20246-1-0.8-0.6-0.4-0.200.20.40.60.81t1/4Dirac(t+4)+...-1/4i31/2Dirac(t-4)-6-4-20246-10-8-6-4-20246810……………………………………………………………………………………………(3)223sin2)(jFcloseallclearall;clc;symstwF=sym('sin(3*(w-2*pi))/(w-2*pi)')f=ifourier(F,t)ezplot(abs(f),[-66]);结果:8F=sin(3*w)/(w-2*pi)f=1/4*exp(2*i*pi*(t+3))*Heaviside(t+3)-1/4*exp(2*i*pi*(t+3))*Heaviside(-t-3)-1/4*exp(2*i*pi*(t-3))*Heaviside(t-3)+1/4*exp(2*i*pi*(t-3))*Heaviside(-t+3)-6-4-2024600.10.20.30.40.5tabs(1/4exp(2i(t+3))Heaviside(t+3)-1/4exp(2i(t+3))Heaviside(-t-3)-1/4exp(2i(t-3))Heaviside(t-3)+1/4exp(2i(t-3))Heaviside(-t+3))3.已知信号f1(t)的波形如图所示,其傅里叶变换为F1(jw)。现有信号f(t)=f1(t)*f1(t),试用Matlab求f(t)的傅里叶变换F(jw),分别绘出f1(t)和f(t)的时域波形及F1(w)和F(w)的频谱曲线,验证时域
本文标题:信号与系统部分实验matlab代码-供参考
链接地址:https://www.777doc.com/doc-5009805 .html