数字信号处理上机实验报告姓名:学号:实验一:设给定模拟信号1000taxte,的单位是ms。(1)利用MATLAB绘制出其时域波形和频谱图(傅里叶变换),估计其等效带宽(忽略谱分量降低到峰值的3%以下的频谱)。(2)用两个不同的采样频率对给定的进行采样。○1。○2。比较两种采样率下的信号频谱,并解释。实验一MATLAB程序:(1)N=10;Fs=5;Ts=1/Fs;n=[-N:Ts:N];xn=exp(-abs(n));w=-4*pi:0.01:4*pi;X=xn*exp(-j*(n'*w));subplot(211)plot(n,xn);title('x_a(t)时域波形');xlabel('t/ms');ylabel('x_a(t)');axis([-10,10,0,1]);subplot(212);plot(w/pi,abs(X));title('x_a(t)频谱图');xlabel('\omega/\pi');ylabel('X_a(e^(j\omega))');ind=find(X=0.03*max(X))*0.01;eband=(max(ind)-min(ind));fprintf('等效带宽为%fKHZ\n',eband);运行结果:taxt15000safxtxn以样本秒采样得到。11jxnXe画出及其频谱11000safxtxn以样本秒采样得到。11jxnXe画出及其频谱等效带宽为12.110000KHZ(2).N=10;omega=-3*pi:0.01:3*pi;%Fs=5000Fs=5;Ts=1/Fs;n=-N:Ts:N;xn=exp(-abs(n));X=xn*exp(-j*(n'*omega));subplot(221);stem(n,xn);gridon;axis([-10,10,0,1.25]);title('时域波形(f_s=5000)');xlabel('n');ylabel('x_1(n)');subplot(222);plot(omega/pi,abs(X));title('频谱图(f_s=5000)');xlabel('\omega/\pi');ylabel('X_1(f)');%Fs=1000Fs=1;Ts=1/Fs;n=-N:Ts:N;xn=exp(-abs(n));X=xn*exp(-j*(n'*omega));subplot(223);stem(n,xn);gridon;axis([-10,10,0,1.25]);title('时域波形(f_s=1000)');xlabel('n');ylabel('x_2(n)');subplot(224);plot(omega/pi,abs(X));title('频谱图(f_s=1000)');xlabel('\omega/\pi');ylabel('X_2(f)');运行结果:实验二:给定一指数型衰减信号,采样率,为采样周期。为方便起见,重写成复指数形式。采样后的信号为,加窗后长度为的形式为:0cos2atxteft1sfTT02jftatxtee02jfnTanTxnTeeL这3个信号,,的幅度谱平方分别为:模拟信号:采样信号:加窗(取有限个采样点)信号:且满足如下关系:实验内容(1)在同一张图上画出:模型号幅度谱平方;(2)在同一张图上画出:模型号幅度谱平方;;改变值,结果又如何?(1)f=0:0.01:3;alpha=0.2;f0=0.5;L=10;T1=1;T2=0.5;Xa=1./(alpha^2+(2*pi*(f-f0)).^2);Xs1=T1*(1-2*exp(-alpha*T1*L)*cos(2*pi*(f-f0)*T1*L)+exp(-2*alpha*T1*L))./(1-2*exp(-alpha*T1)*cos(2*pi*(f-f0)*T1)+exp(-2*alpha*T1));Xs2=T2*(1-2*exp(-alpha*T2*L)*cos(2*pi*(f-f0)*T2*L)+exp(-2*alpha*T2*L))./(1-2*exp(-alpha*T2)*cos(2*pi*(f-f0)*T2)+exp(-2*alpha*T2));plot(f,Xa,'b');holdon;plot(f,Xs1,'g');holdon;plot(f,Xs2,'r');,0,1,,1LxnTxnTnLxtxnTLxnT222012Xfaff2201ˆ12cos2aTaTXfeffTe2202012cos2ˆ12cos2aTLaTLLaTaTeffTLeXfeffTeˆˆˆlim,limsLLfXfXfTXfXf100.2sec,0.5Hz,1Hz2Hz=10ssafffL取采样频率分别取和,。2Xf2ˆ1Hz2Hz0Hz3HzssffTXff和时,采样信号幅度谱平方2Xf2ˆ2Hz0Hz3HzsfTXff时,采样信号幅度谱平方Lxlabel('f/Hz');ylabel('|X(f)|^2');legend('模拟信号幅度谱平方|X(f)|^2','f_s=1Hz时,采样信号幅度谱平方|TX(f)|^2','f_s=2Hz时,采样信号幅度谱平方|TX(f)|^2');运行结果:(2)f=0:0.01:3;alpha=0.2;f0=0.5;L1=5;L2=10;L3=20;T1=0.5Xa=1./(alpha^2+(2*pi*(f-f0)).^2);Xs1=T1*(1-2*exp(-alpha*T1*L1)*cos(2*pi*(f-f0)*T1*L1)+exp(-2*alpha*T1*L1))./(1-2*exp(-alpha*T1)*cos(2*pi*(f-f0)*T1)+exp(-2*alpha*T1));Xs2=T1*(1-2*exp(-alpha*T1*L2)*cos(2*pi*(f-f0)*T1*L2)+exp(-2*alpha*T1*L2))./(1-2*exp(-alpha*T1)*cos(2*pi*(f-f0)*T1)+exp(-2*alpha*T1));Xs3=T1*(1-2*exp(-alpha*T1*L3)*cos(2*pi*(f-f0)*T1*L3)+exp(-2*alpha*T1*L3))./(1-2*exp(-alpha*T1)*cos(2*pi*(f-f0)*T1)+exp(-2*alpha*T1));plot(f,Xa,'b');holdon;plot(f,Xs1,'g');holdon;plot(f,Xs2,'r');holdon;plot(f,Xs3,'y')xlabel('f/Hz');ylabel('|X(f)|^2');legend('模拟信号幅度谱平方|X(f)|^2','f_s=2Hz时,采样信号幅度谱平方|TX(f)|^2(L=5)','f_s=2Hz时,采样信号幅度谱平方|TX(f)|^2(L=10)','f_s=2Hz时,采样信号幅度谱平方|TX(f)|^2(L=20)');运行结果:实验三:设,,编写MATLAB程序,计算:(1)5点圆周卷积;(2)6点圆周卷积;(3)线性卷积;(4)画出的,和时间轴对齐。a=[1,2,2];b=[1,2,3,4];y1=cconv(a,b,5);y2=cconv(a,b,6);11,2,2xn21,2,3,4xn1yn2yn3yn1yn2yn3yny3=conv(a,b);figure(1);subplot(311)stem(y1);gridontitle('五点圆周卷积y1(n)');xlabel('n'),ylabel('y1(n)');axis([06015])subplot(312)stem(y2);gridontitle('六点圆周卷积y2(n)');xlabel('n'),ylabel('y2(n)');axis([06015])subplot(313)stem(y3);gridontitle('线性卷积y3(n)');xlabel('n'),ylabel('y3(n)');axis([06015]);运行结果:x1=[1,2,2];x2=[1,2,3,4];n1=0:4;y1=cconv(x1,x2,5);n2=0:5;y2=cconv(x1,x2,6);n3=0:length(x1)+length(x2)-2;y3=conv(x1,x2);subplot(3,1,1);stem(n1,y1);axis([-1,6,0,16]);subplot(3,1,2);stem(n2,y2);axis([-1,6,0,16]);subplot(3,1,3);stem(n3,y3);axis([-1,6,0,16]);运行结果:实验四:给定因果系统:(1)求系统函数并画出零极点示意图。(2)画出系统的幅频特性和相频特性。(3)求脉冲响应并画序列图。提示:在MATLAB中,zplane(b,a)函数可画零极点图;Freqz(b,a,N)可给出范围内均匀间隔的点频率响应的复振幅;Impz(b,a,N)可求的逆变换(即脉冲响应)。0.91ynynxnHzjHehn0,NHza=[1,0]b=[1,-0.9]figure(1)zplane(b,a);title('零极点分布图')w=[-3*pi:0.01:3*pi];[h,phi]=freqz(b,a,w);figure(2);subplot(3,1,1);plot(w,abs(h));gridon;title('幅频特性');xlabel('f/Hz'),ylabel('H(f)');subplot(3,1,2);plot(w,phi);gridon;title('相频特性');xlabel('f/Hz'),ylabel('W(f)');subplot(3,1,3);impz(b,a);运行结果: