基于窗函数法的FIR数字低通滤波器设计
用布莱克曼语音信号进行滤波,并得滤波前后信号的时域波形及频谱程序 clear;clc;
[x,fs]=wavread('D:\\SHE.wav'); sound(x,fs); if x/2==0 x=[x' 0]; end
fnoise =10000;T=length(x)/fs; t=T/length(x):T/length(x):T; for j=1:length(x)
noise(j)=sin(2*pi*fnoise*t(j)); end x=x+noise'; fp=1000; fst=1200;
delta_w=2*pi*(fst-fp)/fs; wc=pi*(fst+fp)/fs; N=31; if N/2==0 N=N+1; end tau=(N-1)/2; for n=1:N
h(n)=sin(wc*(n-tau))/(pi*(n-tau)); end
h((N-1)/2)=(fst+fp)/fs; wn=(blackman(N)); h1=h(n).*wn';
subplot(2,1,1);stem(h1); F=abs(fft(h1));
14
基于窗函数法的FIR数字低通滤波器设计
subplot(2,1,2); plot(F(1:(N-1)/2)); X=abs(fft(x)); figure;subplot(2,1,1); plot(X(1:(length(x)+1)/2)); y=conv(x,h1); Y=abs(fft(y)); subplot(2,1,2);
plot(Y(1:(length(x)+1)/2)); sound(x,fs); sound(y,fs);
15