数字信号处理上机报告-一.doc
. . 数字信号处理第一次上机实验报告实验一:设给定模拟信号,的单位是ms。(1) 利用MATLAB绘制出其时域波形和频谱图(傅里叶变换),估计其等效带宽(忽略谱分量降低到峰值的3%以下的频谱)。(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(jomega)');ind = find(X >=0.03*max(X)*0.01;eband = (max(ind) -min(ind);fprintf('等效带宽为 %fKHZn',eband);运行结果:等效带宽为 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);grid on;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);grid on;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)');运行结果:实验二:给定一指数型衰减信号,采样率,为采样周期。为方便起见,重写成复指数形式。采样后的信号为,加窗后长度为的形式为:这3个信号,的幅度谱平方分别为:模拟信号:采样信号:加窗(取有限个采样点)信号:且满足如下关系:实验容(1) 在同一图上画出:模型号幅度谱平方;(2) 在同一图上画出:模型号幅度谱平方;改变值,结果又如何?(1)f=0:0.01:3;alpha=0.2;f0=0.5;L=10;T1=1;T2=0.5;Xa=1./(alpha2+(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');hold on;plot(f,Xs1,'g');hold on;plot(f,Xs2,'r');xlabel('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./(alpha2+(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');hold on;plot(f,Xs1,'g');hold on;plot(f,Xs2,'r');hold on;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程序,计算:() 点圆周卷积;() 点圆周卷积;() 线性卷积;() 画出的,和时间轴对齐。a = 1,2,2;b = 1,2,3,4;y1 = cconv(a,b,5);y2 = cconv(a,b,6);y3 = conv(a,b);figure(1);subplot(311)stem(y1);grid ontitle('五点圆周卷积y1(n)');xlabel('n'),ylabel('y1(n)');axis(0 6 0 15)subplot(312)stem(y2);grid ontitle('六点圆周卷积y2(n)');xlabel('n'),ylabel('y2(n)');axis(0 6 0 15)subplot(313)stem(y3);grid ontitle('线性卷积y3(n)');xlabel('n'),ylabel('y3(n)');axis(0 6 0 15);运行结果: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);运行结果:实验四:给定因果系统:() 求系统函数并画出零极点示意图。() 画出系统的幅频特性和相频特性。() 求脉冲响应并画序列图。提示:在中,zplane(b,a) 函数可画零极点图;Freqz(b,a,N)可给出围均匀间隔的点频率响应的复振幅;Impz(b,a,N)可求的逆变换(即脉冲响应)。a = 1,0b = 1,-0.9figure(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);grid on;title('幅频特性');xlabel('f/Hz'),ylabel('H(f)');subplot(3,1,2);plot(w, phi);grid on;title('相频特性');xlabel('f/Hz'),ylabel('W(f)');subplot(3,1,3);impz(b,a);运行结果:10 / 10