figure(2);
subplot(2,2,1);plot(abs(Y1));axis([0,4000,0,1.0]); title('滤波前信号频谱');
subplot(2,2,2);plot(abs(X));axis([0,4000,0,1.0]); title('滤波后信号频谱'); subplot(2,2,3);plot(z1); title('滤波前信号波形'); subplot(2,2,4);plot(x); title('滤波后信号波形'); sound(x,fs,bits); 图如下:
②选用cheby1 程序设计如下: clear;close all
[z1,fs,bits]=wavread('F:\\wqk.wav') y1=z1(1:8192); Y1=fft(y1);
fp1=1200 ;fp2=3000; fc1=1000 ;fc2=3200 ;As=100;Ap=1; Fs=8000; wc=[2*fc1/Fs,2* fc2/Fs];wb=[2*fp1/Fs,2*fp2/Fs]; [n,wp]=cheb1ord(wc,wb,Ap,As); [b,a]=cheby1(n,Ap,wp,'z'); figure(1); freqz(b,a); x=filter(b,a,z1); X=fft(x,8192); figure(2);
subplot(2,2,1);plot(abs(Y1));axis([0,4000,0,1.0]); title('滤波前信号频谱');
subplot(2,2,2);plot(abs(X));axis([0,4000,0,1.0]); title('滤波后信号频谱'); subplot(2,2,3);plot(z1); title('滤波前信号波形'); subplot(2,2,4);plot(x); title('滤波后信号波形'); sound(x,fs,bits); 图如下:
图22
选用ellip 程序:
clear;close all
[z1,fs,bits]=wavread('F:\\wqk.wav') y1=z1(1:8192);
Y1=fft(y1);
fp1=1200;fc1=1000;fp2=3000;fc2=3200;As=100;Ap=1; ;Fs=8000; wc=[2*fc1/Fs,2*fc2/Fs];wb=[2*fp1/Fs,2*fp2/Fs]; [n,wp]=ellipord(wc,wb,Ap,As); [b,a]=ellip(n,Ap,As,wp); figure(1); freqz(b,a); x=filter(b,a,z1); X=fft(x,8192);
figure(2);
subplot(2,2,1);plot(abs(Y1));axis([0,4000,0,1.0]); title('滤波前信号频谱');
subplot(2,2,2);plot(abs(X));axis([0,4000,0,1.0]); title('滤波后信号频谱'); subplot(2,2,3);plot(z1); title('滤波前信号波形'); subplot(2,2,4);plot(x); title('滤波后信号波形'); sound(x,fs,bits);
图形截图: