I have to design a bandpass filter with passband frequency [300Hz 500Hz] and sampling frequency is 16kHz.The stopband attenuation required is 60dB.I have used butterworth filter in MATLAB to design the filter. Now to implement the same specifications using an FIR filter, what should be the order of filter chosen. My doubt is that if for any given filter design specification, is there any method by which we can say that an IIR filter of order M can generate a magnitude response equivalent to an FIR filter of order N
-
1$\begingroup$ That's not enough specification for a unique answer. You also need to add something like transition-band width(s), passband ripple, etc. $\endgroup$– HilmarJan 20 at 8:34
-
$\begingroup$ My doubt is that if for any given filter design specification, is there any method by which we can say that an IIR filter of order M can generate a magnitude response equivalent to an FIR filter of order N $\endgroup$– DeepaJan 20 at 8:41
-
$\begingroup$ Your comment significantly modifies the question. You should edit your question to include that doubt. $\endgroup$– TimWescottJan 21 at 17:48
1 Answer
This question could probably be flagged as a duplicate, but I'll answer here and let the mods decide if it's worth keeping.
Dan Boschen on Fred Harris' Rule of Thumb.
$$ N = \bigg\lfloor\frac{f_s}{\Delta f}\frac{\mathtt{Attn(dB)}}{22}\bigg\rfloor$$ For your specs, $N = \big\lfloor\frac{16e3}{200}\frac{60}{22}\big\rfloor = 218$
This answer by Laurent Duval also provides additional resources
Matlab firpmord function for Parks-McClellan FIR design. You need to specify the transition bands (see end of this answer for example code)
There's no universal rule. You can start with some ballpark $N$ and increase until you meet your specs.
Matlab Code for 3.
rp = 0.1; % Passband ripple in dB
rs = 60; % Stopband ripple in dB
fs = 16000; % Sampling frequency
f = [200 300 500 600]; % Cutoff frequencies
a = [0 1 0]; % Desired amplitudes
dev = [10^(-rs/20) (10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)]; %linear
[n,fo,ao,w] = firpmord(f,a,dev,fs);
b = firpm(n,fo,ao,w);
freqz(b,1,4096,fs)
title('bandpass Filter Designed to Specifications')
-
2$\begingroup$ Thanks @DanBoschen, will add to the answer. Like I said, I think this question has been asked and answered before, but since my answer is tailored to the OP's question, I figured it might be worth it. $\endgroup$– JdipJan 20 at 13:14
-
2$\begingroup$ Yes agree, the question is more specific--- what you are missing but you could add is how it relates to N for an all pole IIR (where we get 20 dB/decade for each pole... so 20N dB/decade which could be backed out into a form similar to fred's...) .then we see exactly the answer to his question in terms of these initial estimates. This would be specific to all pole IIR rather than what is mixed FIR/IIR as typically done in IIR filters with poles and zeros. I'm deleting my earlier comment since it's now in your answer and just noise down here. $\endgroup$ Jan 20 at 13:25
-
$\begingroup$ @DanBoschen If I get some bandwidth I'll gladly add. But feel free to edit my answer or do one with what you mentioned, I'd be interested in your derivation. $\endgroup$– JdipJan 20 at 13:35