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

wp=0.24*pi;ws=0.3*pi; fs=150;fp=120; Wc=(wp+ws)/(2*pi); B=2*pi*(fs-fp)/Fs; Nb=ceil(11*pi/B);

hn=fir1(Nb-1,Wc,blackman(Nb)); Hw=abs(fft(hn,N)) xt=xtg; y=fftfilt(hn,xt,N) f=(0:N-1)*Fs/N; figure(2) subplot(211)

plot(f,20*log10(Hw/max(Hw)));title('低通滤波器幅频特性') xlabel('f/Hz');ylabel('幅度');axis([0,Fs/2,-120,10]); subplot(212)

plot(f/2000,y);title('滤除噪声后的信号波形') xlabel('t/s');ylabel('yw(t)');

图1 信号及其频谱

图2 低通滤波器滤除噪声