0
$\begingroup$

FIR filters are generally stable and have linear phase response. These two characteristics are often desired in dsp

So why do we need and use IIR filters,despite the fact that IIR filters often have issues in these two characteristics of stability and linear phase response ?

$\endgroup$
  • $\begingroup$ Our practical guide on IIR filters may help. $\endgroup$ – ASN Apr 22 '20 at 8:08
  • $\begingroup$ @ASN : Welcome to SE.SP! I've converted your answer to a comment because we usually don't accept link-only answers. This is why I kept your other answer, but copied a small part of the relevant webpage into your answer. If you want to do the same here, feel free to try another answer. $\endgroup$ – Peter K. Apr 22 '20 at 11:38
1
$\begingroup$

The biggest advantage of IIR filter is that you can achieve the filter specifications with much lesser order compared to FIR.

In a recent question (Lowpass Hann filter in Python) a transition band $\omega_{cutoff-passband}=0.05\pi$ to $\omega_{stopband}=0.136\pi$ was achieved with just $N_{IIR}=4$, but using FIR filter with Kaiser window, the order $N_{FIR}=55$. This results in much less complexity in implementation (multipliers, adders) reducing area required for implementation on a chip. In the above exmaple, for a given output, IIR requires 4 multipliers and 5 addition operations. For FIR, 55 multiplications and 54 addition operations are needed. Of course, there are provisions for optimizing this, but you get the idea..

Also, for the given example, in the pass band the phase is nearly linear for the IIR filter, so it results in much less distorted output for the pass band frequencies (stop band frequencies will get distorted but they are attenuated away by the filter). In IIR, you have the additional flexibility of placing poles as per your requirement to fine tune the filter attenuation/ripple. So it may seems FIR has advantage in terms of pure linear phase but IIR isn't far behind.

Code used to compare the order

clc
clear all

fc1=1200;
fc2=3000;
fs=44100;
rp=1;
att=40;
[n,wp]=cheb1ord(fc1/(fs/2), fc2/(fs/2), rp, att);
[b,a]=cheby1(n,rp,wp,'low');
freqz(b,a)
[n1,Wn,beta,ftype] = kaiserord([fc1 fc2],[1 0],[0.9 0.01],fs);
hh = fir1(n1,Wn,ftype,kaiser(n1+1,beta),'noscale');
freqz(hh,1,1024,fs)

Zoomed view near transition band enter image description here

As you can see Chebyshev Type-1 provides a much higher attenuation of frequencies beyond pass band cutoff ($\text{1200Hz}$).

$\endgroup$
1
$\begingroup$

IIR filters require less calculations per sample output, for example consider the M point moving average (FIR) and leaky integrator (IIR) low pass filters, with all the goodness of the moving average in terms of linear phase, stability etc, they require M multiplications and M-1 additions per output. Whereas an IIR filter requires 2 multiplication and 1 addition.

So the bottomline, any time computation cycles in not an issue, go for for FIR

Disclaimer: there are certain situations (such as DC removal) where IIR is a very apt and natural choice

$\endgroup$
0
$\begingroup$

You could capture the impulse response of an IIR filter, apply a window and apply it as a long FIR filter approximating the IIR filter. It would usually be a bad idea though.

If you are making, say, a user-facing Equalizer, IIR filters can offer a simple parametrization of "cutoff frequency" rather than recalculating a sinc function every time the user twists a knob.

Common design strategies for FIR filters produce linear phase. IIR-filters cannot be linear phase. Linear phase vs nonlinear phase have significant and subtle implications.

IIR filters have less arithmetic and memory requirements. But I believe that slightly higher numerical precision is usually required for similar results.

-k

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.