Comparing IIR and FIR Filters

Another method of classification of filters is based on their impulse response. But what is an impulse response? The response of a filter to an input that is an impulse (x[0] = 1 and x[i] = 0 for all i 0) is called the impulse response of the filter; see the illustration below. The Fourier transform of the impulse response is known as the frequency response of the filter. The frequency response of a filter tells you what the output of the filter is going to be at different frequencies. In other words, it tells you the gain of the filter at different frequencies. For an ideal filter, the gain should be 1 in the passband and 0 in the stopband. So, all frequencies in the passband are passed as is to the output, but there is no output for frequencies in the stopband.

If the impulse response of the filter falls to zero after a finite amount of time, it is known as a finite impulse response (FIR) filter. However, if the impulse response exists indefinitely, it is known as an infinite impulse response (IIR) filter. Whether the impulse response is finite or not (that is, whether the filter is FIR or IIR) depends on how the output is calculated.

The basic difference between FIR and IIR filters is that for FIR filters, the output depends only on the current and past input values, whereas for IIR filters, the output depends not only on the current and past input values, but also on the past output values.

As an example, consider a cash register at a supermarket. Let x[k] be the cost of the present item that a customer buys and x[k–1] is the price of the previous item, where 1 k N, and N is the total number of items. The cash register adds the cost of each item to produce a running total. This running total y[k], up to the kth item, is given by

y[k] = x[k] + x[k–1] + x[k–2] + x[k–3] + .....+ x[1](1)

Thus, the total for N items is y[N]. Because y[k] is the total up to the kth item, and y[k–1] is the total up to the (k – 1)st item, you can rewrite Equation (1) as

y[k] = y[k–1] + x[k](2)

If you add a sales tax of 8.25%, Equations 1 and 2 can be rewritten as

y[k] = 1.0825x[k] + 1.0825x[k–1] + 1.0825 x[k–2] +(3)
1.0825x[k–3] + … + 1.0825x[1]
y[k] = y[k–1] + 1.0825x[k](4)

Note that both Equations (3) and (4) are identical in describing the behavior of the cash register. The difference is that whereas Equation (3) is implemented only in terms of the inputs, Equation (4) is implemented in terms of both the input and the output. Equation (3) is known as the nonrecursive, or FIR, implementation. Equation (4) is known as the recursive, or IIR, implementation.

Filter Coefficients

In Equation (3), the multiplying constant for each term is 1.0825. In Equation (4), the multiplying constants are 1 (for y[k–1]) and 1.0825 (for x[k]). These multiplying constants are known as the coefficients of the filter. For an IIR filter, the coefficients multiplying the inputs are known as the forward coefficients, and those multiplying the outputs are known as the reverse coefficients.

Equations of the form (1), (2), (3), or (4) that describe the operation of the filter are known as difference equations.

The disadvantage of IIR filters is that the phase response is nonlinear. If the application does not require phase information, such as signal monitoring, IIR filters may be appropriate. You should use FIR filters for those applications requiring linear phase responses. The recursive nature of IIR filters makes them more difficult to design and implement.