Bandpass FIR filter using windowing and matlab

Thread Starter

ElectricFlow

Joined May 3, 2009
1
I am working on an assignment for school in DSP. I need to Design a linear phase, causal, digital Bandpass FIR filter using the windowing method that meets the following specifications with the lowest possible filter length, M:

Sampling Freq: 24Khz
passband p1 2pi4000 p2= 2pi8000
stopband st1=2pi3000 st2= 2pi9000
minimum stopoband attensuation= 40dB

I found some Matlab code online and started altering it to my specifications. However I am not sure what i need to use for the DEV variable, or if I have the rest of it right at all. Any help would be appreciated. The code i have is shown below.

fs=24000; % sampling rate
F=[3000 4000 8000 9000]; % band limits
A=[0 1 0]; % band type: 0='stop', 1='pass'
dev=[0.0001 10^(0.1/20)-1 0.0001]; % ripple/attenuation spec
[M,Wn,beta,typ]= kaiserord(F,A,dev,fs); % window parameters
b=fir1(M,Wn,typ,kaiser(M+1,beta),'noscale'); % filter design
 
Top