数字信号处理第三版高西全实验 下载本文

内容发布更新时间 : 2024/5/18 4:32:44星期一 下面是文章的全部内容请认真阅读。

数字信号处理高西全版课后上机实验

1. 实验一:系统响应及系统稳定性

clc clear

x1=[ones(1,8),zeros(1,20)]; subplot(321) stem(x1,'.')

title('u8(n)');xlabel('n');ylabel('u(n)'); x2=ones(1,30); subplot(322) stem(x2,'.')

title('u(n)');xlabel('n');ylabel('u(n)'); B=[0.05,0.05]; A=[1,-0.9];

y1=filter(B,A,x1); subplot(323) stem(y1,'.')

title('y(n)');xlabel('n');ylabel('y(n)'); y2=filter(B,A,x2); subplot(324) stem(y2,'.')

title('y(n)');xlabel('n');ylabel('y(n)'); x3=[1,zeros(1,30)]; subplot(325) stem(x3,'.')

title('单位脉冲');xlabel('n');ylabel('u(n)'); y3=filter(B,A,x3); subplot(326) stem(y3,'.')

title('单位脉冲响应');xlabel('n');ylabel('y(n)');

图1 实验(1)波形

clc clear

x1=[ones(1,8),zeros(1,20)]; subplot(321) stem(x1,'.')

title('u8(n)');xlabel('n');ylabel('u(n)'); h1=[ones(1,10),zeros(1,20)]; subplot(322) stem(h1,'.')

title('h1(n)');xlabel('n');ylabel('h(n)'); h2=[1,2.5,2.5,1,zeros(1,20)]; subplot(323) stem(h2,'.')

title('h2(n)');xlabel('n');ylabel('h(n)'); y1=conv(x1,h1) subplot(324) stem(y1,'.')

axis([0,30,0,10])

title('y1(n)');xlabel('n');ylabel('y(n)'); y2=conv(x1,h2) subplot(325) stem(y2,'.')

axis([0,30,0,10])

title('y2(n)');xlabel('n');ylabel('y(n)');

图2 实验(2)波形

clc clear clf

x1=ones(1,50); subplot(221) stem(x1,'.') axis([0,50,0,1])

title('u(n)');xlabel('n');ylabel('u(n)'); A=[1,-1.8237,0.9801]; B=[1/100.49,0,-1/100.49]; y1=filter(B,A,x1); subplot(223) stem(y1,'.')

axis([0,50,-0.05,0.05])

title('y(n)');xlabel('n');ylabel('y(n)'); n=0:100;

x2=sin(0.014*n)+sin(0.4*n); subplot(222) stem(x2,'.')

axis([0,100,-1,2])

title('x(n)');xlabel('n');ylabel('x(n)'); y2=filter(B,A,x2);

subplot(224) stem(y2,'.')

axis([0,100,-1,1])

title('y(n)');xlabel('n');ylabel('y(n)');

图3 实验(3)波形

2. 实验二:时域采样与频域采样 A=444.128; a=50*sqrt(2)*pi; w=50*sqrt(2)*pi; fs1=1000; N1=0.064*fs1; n=0:N1-1;

xn1=A.*exp(-a*n/fs1).*sin(w*n/fs1).*(n>=0); subplot(321) stem(xn1,'.')

axis([0,55,-10,150])

title('x1(n) fs=1kHz');xlabel('n');ylabel('x1(n)'); Xk1=fft(xn1,N1); f1=(0:N1-1)/0.064; subplot(322)

plot(f1,abs(Xk1/fs1))

title('T*FT[x(nT)], Fs=1000Hz'); fs2=300;

N2=floor(0.064*fs2); n=0:N2-1;

xn2=A.*exp(-a*n/fs2).*sin(w*n/fs2).*(n>=0); subplot(323) stem(xn2,'.')

axis([0,20,-10,150])

title('x2(n)fs=300Hz');xlabel('n');ylabel('x2(n)'); Xk2=fft(xn2,N2); f2=(0:N2-1)/0.064; subplot(324)

plot(f2,abs(Xk2/fs2))

title('T*FT[x(nT)], Fs=300Hz'); fs3=200;

N3=floor(0.064*fs3); n=0:N3-1;

xn3=A.*exp(-a*n/fs3).*sin(w*n/fs3).*(n>=0); subplot(325) stem(xn3,'.')

axis([0,15,-10,150])

title('x3(n)fs=200Hz');xlabel('n');ylabel('x3(n)'); Xk3=fft(xn3,N3) f3=(0:N3-1)/0.064; subplot(326)

plot(f3,abs(Xk3/fs3))

title('T*FT[x(nT)], Fs=200Hz');

图1 实验(1)时域采样