FIR vs IIR Filters: Stability, Phase and Filter Order

Both are digital filters that shape the frequency response of a signal, but they differ in whether past outputs are used in the calculation. An FIR (finite impulse response) filter only multiplies the current and past inputs by coefficients and adds them up, so its impulse response ends after as many samples as it has taps. An IIR (infinite impulse response) filter also feeds past outputs back into the calculation, so in theory its impulse response goes on forever. An FIR filter is always stable and becomes linear phase if its coefficients are symmetric, but a sharp response needs many taps. An IIR filter achieves a sharp response with a low order, but its phase is not linear and it can become unstable depending on where its poles lie.

AspectFIR filterIIR filter
Difference equation and impulse responsey[n] = Σh[k]x[n − k]: a weighted sum of inputs only; the impulse response ends after N tapsy[n] = Σb[k]x[n − k] − Σa[k]y[n − k]: past outputs are fed back, and the impulse response decays but continues
Transfer function H(z) and stabilityNo denominator; the only poles are at z = 0, so it is always stable whatever the coefficientsHas a denominator; stable only if all poles lie inside the unit circle
Phase responseLinear phase if the coefficients are symmetric; the group delay is (N − 1)/2 samples at every frequencyNot linear phase; the group delay changes with frequency and grows near the cutoff
Order needed for the same specification (example)For a low-pass filter at fs = 48 kHz with a 4 kHz passband edge, a 5 kHz stopband edge, 60 dB attenuation and 0.5 dB passband ripple, an equiripple design needs about 110 tapsAn elliptic filter meeting the same specification is 7th order (4 second-order sections)
Computation per output sampleAs many multiply-accumulates as taps: about 110 in the example (symmetry roughly halves the multiplications)About 5 multiplications per second-order section: about 20 in the example
DelayConstant (N − 1)/2 samples: about 56 samples (about 1.2 ms) in the exampleVaries with frequency: in the example about 9 samples at low frequencies and about 75 samples at the passband edge
Coefficient quantization (fixed point)The frequency response changes slightly, but stability is never lostImplementing a high-order equation directly can move poles and cause instability; it is implemented as a cascade of second-order sections (biquads)
Main design methodsWindow method, equiripple (Parks-McClellan) methodBilinear transform of an analog prototype (Butterworth, Chebyshev, elliptic and others)
Typical usesCommunications and measurement where the waveform shape must be kept, audio and image processing, decimation and interpolation filters, adaptive filtersEmbedded devices that must save computation and memory, audio equalizers, DC removal and exponential smoothing

Figures are typical orders of magnitude and vary by process generation and product.

When to use which

FIR filter
When the waveform shape must not be distorted (pulse shaping in communications, measurement, audio and image processing), for decimation and interpolation filters, and for adaptive filters that must stay stable while their coefficients change. It needs many multiply-accumulates, but DSPs and FPGAs can process them in parallel.
IIR filter
When computation, memory or delay must be kept small. In uses where phase distortion does not matter, it gives sharp responses, narrow notches and DC removal with little calculation.

FAQ

What do the names FIR and IIR describe?

The length of the impulse response, the output for an impulse (a signal that is 1 only at n = 0). An FIR (finite impulse response) filter's response returns to 0 after a finite length, which is N for N taps. An IIR (infinite impulse response) filter's response keeps going because of feedback: for y[n] = 0.2x[n] + 0.8y[n − 1], the impulse response is 0.2 × 0.8ⁿ, approaching 0 but never ending.

What is the benefit of linear phase?

All frequency components are delayed by the same time, so the shape of the waveform in the passband is preserved. For an N-tap FIR filter with symmetric coefficients, the delay is (N − 1)/2 samples at every frequency: 50 samples for 101 taps (about 1.04 ms at 48 kHz). An IIR filter delays different frequencies by different amounts, which distorts the shape of pulses and steps.

Why can an IIR filter become unstable?

Because it feeds the output back: if a pole (a value of z where the denominator of the transfer function is 0) lies outside the unit circle, the output grows without limit. A first-order filter such as y[n] = x[n] + 0.5y[n − 1] is stable because the feedback coefficient is smaller than 1 in magnitude, but in a sharp high-order filter the poles cluster near the unit circle, and rounding the coefficients alone can push one outside. That is why it is split into second-order sections.

Is there a way to remove the phase shift of an IIR filter?

If recorded data is processed afterwards, applying the same filter forward and then backward cancels the phase shift (zero-phase filtering). This is not possible in real time, because it needs future inputs, so real-time systems either correct the group delay with an all-pass filter or choose a linear-phase FIR filter.

Check your understanding

Which of the following is a characteristic of an FIR (finite impulse response) filter?

  1. AIt has feedback from the output to the input side, so a steep response can be obtained with few coefficients
  2. BIts impulse response continues forever, so it easily becomes unstable when its coefficients are quantized
  3. CIt has no feedback, so it is always stable, and symmetric coefficients give it linear phase
Show answer and explanation

Answer: C. It has no feedback, so it is always stable, and symmetric coefficients give it linear phase

An FIR filter only multiplies the present and past inputs by coefficients and adds them; it has no output feedback. Its impulse response ends after the number of coefficients (taps), and its poles lie only at z = 0, so it is stable whatever the coefficient values. With symmetric coefficients it has linear phase, delaying every frequency component by the same time and preserving the shape of the waveform. In exchange, a steep response needs more taps than an IIR filter.

Which of the following 5-tap FIR filters has linear phase?

  1. Ah = {1, 2, 3, 2, 1}
  2. Bh = {1, 2, 3, 4, 5}
  3. Ch = {5, 4, 3, 2, 1}
Show answer and explanation

Answer: A. h = {1, 2, 3, 2, 1}

If the coefficients of an FIR filter are symmetric about the center (h[n] = h[N − 1 − n]), the phase is a straight line proportional to frequency, and every frequency component is delayed by the same (N − 1)/2 samples. {1, 2, 3, 2, 1} is symmetric about the central 3, so it is a linear-phase filter with a constant delay of 2 samples. {1, 2, 3, 4, 5} and {5, 4, 3, 2, 1} are neither symmetric nor antisymmetric, so their delay changes with frequency.

Which of the following is the group delay of a 101-tap linear-phase FIR filter (with symmetric coefficients)?

  1. A50 samples
  2. B50.5 samples
  3. C101 samples
Show answer and explanation

Answer: A. 50 samples

The group delay of an N-tap FIR filter with symmetric coefficients is (N − 1)/2 samples at every frequency. For N = 101 this is (101 − 1)/2 = 50 samples, the position of the center coefficient (the 51st coefficient, h[50]). At a sampling frequency of 48 kHz this is a delay of 50 ÷ 48000 ≈ 1.04 ms, and in real-time processing it must be kept in mind that more taps mean more delay.

  1. Which of the following gives the gains at DC and at the Nyquist frequency of the first-order IIR low-pass filter given by the exponential smoothing y[n] = 0.2x[n] + 0.8y[n − 1]?
  2. Which of the following correctly describes the bilinear transform used to design a digital filter from the transfer function H(s) of an analog filter?
  3. Which of the following is a correct precaution when implementing a high-order IIR filter in fixed point with coefficients of limited bit width?

Practice Digital Signal Processing Basics questions

Key terms explained

FIR filter
A digital filter whose impulse response ends after a finite length (finite impulse response filter). It computes y[n] = Σh[k]x[n − k], multiplying the present and past N inputs by coefficients and adding them, and has no output feedback. Its poles lie only at z = 0, so it is always stable whatever the coefficients, and symmetric coefficients give linear phase, delaying every frequency component by (N − 1)/2 samples. On the other hand, a steep response needs many taps, and each output sample takes as many multiply-accumulate operations as there are taps.
IIR filter
A digital filter that feeds past outputs back to the input side and whose impulse response continues forever (infinite impulse response filter). It is computed with a difference equation such as y[n] = 0.2x[n] + 0.8y[n − 1] (exponential smoothing), and its transfer function has a denominator. It achieves a steep response with few coefficients, little computation and small delay, but its phase is not linear. It becomes unstable unless all its poles lie inside the unit circle, and high-order filters are sensitive to coefficient quantization, so they are often implemented as a cascade of second-order sections (biquads). Designing from an analog filter with the bilinear transform is a common method.
Linear phase
The property of a filter whose phase response is a straight line proportional to frequency. Every frequency component is then delayed by the same time (the group delay is constant), so the waveform keeps its shape. An FIR filter has exactly linear phase when its coefficients are symmetric (or antisymmetric) about the center, with a delay of (N − 1)/2 samples for N taps. A stable, causal IIR filter cannot achieve exactly linear phase, so FIR filters are widely used where waveforms must be preserved, as in audio, communication receivers and measurement.
Group delay
A quantity that describes how much each frequency component of a signal passing through a filter is delayed, defined as the negative derivative of the phase response φ(ω) with respect to frequency (−dφ/dω). If the group delay is the same at all frequencies, the whole waveform is simply delayed with its shape intact. An N-tap FIR filter with symmetric coefficients has a constant group delay of (N − 1)/2 samples. In IIR and analog filters the group delay varies with frequency and often peaks near the cutoff frequency, distorting pulse shapes. Bessel filters are designed for a flat group delay.
Impulse response
The output h[n] of a system when the unit impulse δ[n] (1 only at n = 0 and 0 elsewhere) is applied. For a linear time-invariant (LTI) system, the output for any input is the convolution of the input with h[n], y[n] = Σx[k]h[n − k], so h[n] fully describes the system. A filter whose h[n] ends after a finite length is an FIR filter, and one whose h[n] continues forever is an IIR filter. BIBO stability requires Σ|h[n]| to be finite, and the z-transform of h[n] is the transfer function H(z).
Difference equation
An equation that expresses the output of a discrete-time system as a weighted sum of present and past inputs and past outputs. For example, y[n] = x[n] + 0.5y[n − 1] adds half of the previous output to the present input. One without past outputs on the right-hand side is an FIR filter, and one with past outputs (with feedback) is usually an IIR filter whose impulse response continues forever. Given initial values it can be computed step by step and implemented directly in software or hardware. Applying the z-transform to both sides gives the transfer function H(z).
z-transform
A method that converts a discrete-time signal x[n] into a function of the complex number z, X(z) = Σx[n]z^(−n). A delay of one sample corresponds to multiplying by z⁻¹, so a difference equation can be handled as a ratio of polynomials in z (the transfer function H(z)). Values of z that make the denominator of H(z) zero are called poles and those that make the numerator zero are called zeros; a causal system is stable when all its poles lie inside the unit circle. Evaluating on the unit circle with z = e^(jω) gives the frequency response. It is the discrete-time counterpart of the Laplace transform.
Moving-average filter
The simplest low-pass filter, which outputs the average of the latest N samples. It is y[n] = (x[n] + x[n − 1] + … + x[n − N + 1])/N, an FIR filter whose coefficients are all 1/N. Its DC gain is 1 and its gain is 0 at integer multiples of fs/N, so averaging over an interval that exactly matches the mains period, for example, removes noise at the mains frequency and its harmonics. Its coefficients are symmetric, so it has linear phase with a delay of (N − 1)/2 samples. Updating the sum by adding the newest sample and subtracting the oldest allows computation with few operations regardless of N.

Related comparisons