How to design a Kaiser Bandpass Filter

2 views (last 30 days)
Steven
Steven on 4 Nov 2014
I have a question about how to implement a kaiser bandpass filter given a set of design parameters which can be seen in the MATLAB code below. I don't know how to get the correct design coefficients because I keep getting an error. The problem is that I have my passband frequencies and stopband frequencies in an array so I'm not quite sure how to calculate the cut-off frequencies and how to calculate the order. Can someone please help with this problem? How would I calculate M and what necessary changes do I need to make to the fir1 function?
% design parameters
wp=[2000*pi,3000*pi]; ws=[1000*pi,4000*pi];
f0=8000; w0=2*pi*f0;
A=45;
% cut-off frequency
wc=0.5*(wp+ws)
% normalized cut-off frequency
wc_n=wc/(0.5*w0)
% delta cut-off frequency
del_wc=ws-wp
% delta normalized cut-off frequency
del_wc_n=del_wc/(0.5*w0)
% beta if(A<=21) beta=0; elseif(21<A & A<50) beta=0.5842*(A-21)^0.4+0.07886*(A-21); elseif(A>=50) beta=0.1102*(A-8.7); end
% order
M=(A-7.95)./(2.285*pi*del_wc_n);
M=ceil(M);
% filter coefficients
b=fir1(M-1,wc_n,kaiser(M,beta));
% magnitude
[H,f]=freqz(b,1,256,f0);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!