窗函式設計低通濾波器:
fp=1000;
fc=1200;
as=100;
ap=1;
fs=22000;
wp=2*fp/fs;
wc=2*fc/fs;
N=ceil((as-7.95)/(14.36*(wc-wp)/2))+1;
beta=0.1102*(as-8.7);
window=Kaiser(N+1,beta);
b=fir1(N,wc,window);
freqz(b,1,512,fs);
高通濾波器:
Wp=2*5000/fs;
Ws=2*4800/fs;
Ap=1;
As=100;
N=ceil(8*pi/(Wp-Ws))+1;
N=N+mod(N+1,2)+1;
Wc=(Wp+Ws)/2/pi;
h=fir1(N,Wc,"high");
omega=linspace(0,pi,512);
freqz(h,1,omega);
帶通濾波器:
Wp1=2*1200/fs;
Wp2=2*3000/fs;
Wc1=2*1000/fs;
Wc2=2*3200/fs;
W1=(Wp1+Wc1)/2;
W2=(Wp2+Wc2)/2;
wdth=min((Wp1-Wc1),(Wc2-Wp2));
N=ceil(11*pi/wdth)+1;
b = fir1(N,[W1 W2]);
freqz(b,1,512,fs)
雙線性法設計低通濾波器:
wc=2*fc/fs; %歸一化截止頻率
[n,wn]=ellipord(wp,wc,ap,as);%求數字濾波器的最小階數和歸一化截止頻率
[b,a]=ellip(n,ap,as,wn);%求傳遞函式的分子分母系數
freqz(b,a,512,fs);
窗函式設計低通濾波器:
fp=1000;
fc=1200;
as=100;
ap=1;
fs=22000;
wp=2*fp/fs;
wc=2*fc/fs;
N=ceil((as-7.95)/(14.36*(wc-wp)/2))+1;
beta=0.1102*(as-8.7);
window=Kaiser(N+1,beta);
b=fir1(N,wc,window);
freqz(b,1,512,fs);
高通濾波器:
fs=22000;
Wp=2*5000/fs;
Ws=2*4800/fs;
Ap=1;
As=100;
N=ceil(8*pi/(Wp-Ws))+1;
N=N+mod(N+1,2)+1;
Wc=(Wp+Ws)/2/pi;
h=fir1(N,Wc,"high");
omega=linspace(0,pi,512);
freqz(h,1,omega);
帶通濾波器:
fs=22000;
Wp1=2*1200/fs;
Wp2=2*3000/fs;
Wc1=2*1000/fs;
Wc2=2*3200/fs;
Ap=1;
As=100;
W1=(Wp1+Wc1)/2;
W2=(Wp2+Wc2)/2;
wdth=min((Wp1-Wc1),(Wc2-Wp2));
N=ceil(11*pi/wdth)+1;
b = fir1(N,[W1 W2]);
freqz(b,1,512,fs)
雙線性法設計低通濾波器:
fp=1000;
fc=1200;
as=100;
ap=1;
fs=22000;
wp=2*fp/fs;
wc=2*fc/fs; %歸一化截止頻率
[n,wn]=ellipord(wp,wc,ap,as);%求數字濾波器的最小階數和歸一化截止頻率
[b,a]=ellip(n,ap,as,wn);%求傳遞函式的分子分母系數
freqz(b,a,512,fs);