Infinite impulse response (IIR) filters, also known as recursive filters and autoregressive-moving average (ARMA) filters, operate on current and past input values and current and past output values. The impulse response of an IIR filter is the response of the general IIR filter to an impulse, as the following equations define impulse:
x0 = 1 xi = 0 |
(A) |
for all i ≠ 0.
Theoretically, the impulse response of an IIR filter never reaches zero and is an infinite response.
The following general difference equation characterizes IIR filters.
![]() |
(B) |
where bj is the set of forward coefficients, Nb is the number of forward coefficients, ak is the set of reverse coefficients, and Na is the number of reverse coefficients.
Equation A describes a filter with an impulse response of theoretically infinite length for nonzero coefficients. However, in practical filter applications, the impulse response of a stable IIR filter decays to near zero in a finite number of samples.
In most IIR filter designs and the LabWindows/CVI IIR filters, coefficient a0 is 1. The output sample at the current sample index i is the sum of scaled current and past inputs and scaled past outputs, as shown by Equation B.
![]() |
(C) |
where xi is the current input, xi – j is the past inputs, and yi – k is the past outputs.
IIR filters might have ripple in the passband, the stopband, or both. IIR filters have a nonlinear-phase response.
Equation C defines the direct-form transfer function of an IIR filter.
![]() |
(D) |
A filter implemented by directly using the structure defined by Equation C after converting it to the difference equation in Equation B is a direct-form IIR filter. A direct-form IIR filter often is sensitive to errors introduced by coefficient quantization and by computational precision limits. Also, a filter with an initially stable design can become unstable with increasing coefficient length. The filter order is proportional to the coefficient length. As the coefficient length increases, the filter order increases. As filter order increases, the filter becomes more unstable.
You can lessen the sensitivity of a filter to error by writing Equation C as a ratio of z transforms, which divides the direct-form transfer function into lower order sections, or filter stages.
By factoring Equation C into second-order sections, the transfer function of the filter becomes a product of second-order filter functions, as shown in Equation D.
![]() |
(E) |
where Ns is the number of stages, Ns = [Na/2] is the largest integer less than or equal to (Na/2), and Na ≥ Nb.
You can describe the filter structure defined by Equation D as a cascade of second-order filters. The following figure illustrates cascade filtering.
![]() |
(F) |
You can implement each individual filter stage in the previous figure with the direct-form II filter structure. You then can use the direct-form II filter structure to implement each filter stage for the following reasons:
If n is the number of samples in the input sequence, the filtering operation proceeds as shown in the following equations:
y0[i] = x[i] | (G) |
sk[i] = yk – 1[i – 1] – a1ksk[i – 1] – a2ksk[i – 2] | (H) |
yk[i] = b0ksk[i] + b1ksk[i – 1] + b2ksk[i – 2] | (I) |
for each sample i = 0, 1, 2, …, n – 1 and k = 1, 2, …, Ns.
For lowpass and highpass filters, which have a single cut-off frequency, you can design second-order filter stages directly. The resulting IIR lowpass or highpass filter contains cascaded second-order filters.
Each second-order filter stage has the following characteristics:
For example, an IIR filter with two second-order filter stages must have a total of four reverse coefficients and six forward coefficients, as shown in the following equations.
Total number of reverse coefficients = 2Ns = 2 × 2 = 4
Reverse Coefficients = {a11, a21, a12, a22}
Total number of forward coefficients = 3Ns = 3 × 2 = 6
Forward Coefficients = {b01, b11, b21, b02, b12, b22}
For bandpass and bandstop filters, which have two cut-off frequencies, fourth-order filter stages are a more direct form of filter design than second-order filter stages. IIR bandpass or bandstop filters resulting from fourth-order filter design contain cascaded fourth-order filters.
Each fourth-order filter stage has the following characteristics:
You implement cascade stages in fourth-order filtering in the same manner as in second-order filtering. The following equations show how the filtering operation for fourth-order stages proceeds.
y0[i] = x[i] | (J) |
sk[i] = yk – 1[i – 1] – a1ksk[i – 1] – a2ksk[i – 2] – a3ksk[i – 3] – a4ksk[i – 4] | (K) |
yk[i] = b0ksk[i] + b1ksk[i – 1] + b2ksk[i – 2] – b3ksk[i – 3] – b4ksk[i – 4] | (L) |
where k = 1, 2, …, Ns.
Digital IIR filter designs come from the classical analog designs and include the following filter types:
The IIR filter designs differ in the sharpness of the transition between the passband and the stopband and where they exhibit their various characteristics—in the passband or the stopband.
The Chebyshev, Chebyshev II, and elliptic filters minimize peak error by accounting for the maximum tolerable error in their frequency response. The maximum tolerable error is the maximum absolute value of the difference between the ideal filter frequency response and the actual filter frequency response. The amount of ripple, in dB, allowed in the frequency response of the filter determines the maximum tolerable error. Depending on the type, the filter minimizes peak error in the passband, stopband, or both.
Butterworth filters have the following characteristics:
The advantage of Butterworth filters is their smooth, monotonically decreasing frequency response. The following figure shows the frequency response of a lowpass Butterworth filter.
As shown in the previous figure, after you specify the cut-off frequency of a Butterworth filter, LabWindows/CVI sets the steepness of the transition proportional to the filter order. Higher order Butterworth filters approach the ideal lowpass filter response.
Butterworth filters do not always provide a good approximation of the ideal filter response because of the slow rolloff between the passband and the stopband.
Chebyshev filters have the following characteristics:
Compared to a Butterworth filter, a Chebyshev filter can achieve a sharper transition between the passband and the stopband with a lower order filter. The sharp transition between the passband and the stopband of a Chebyshev filter produces smaller absolute errors and faster execution speeds than a Butterworth filter.
The following figure shows the frequency response of a lowpass Chebyshev filter.
In the previous figure, the maximum tolerable error constrains the equiripple response in the passband. Also, the sharp rolloff appears in the stopband.
Chebyshev II filters have the following characteristics:
Chebyshev II filters are similar to Chebyshev filters. However, Chebyshev II filters differ from Chebyshev filters in the following ways:
The following figure shows the frequency response of a lowpass Chebyshev II filter.
In the previous figure, the maximum tolerable error constrains the equiripple response in the stopband. Also, the smooth monotonic rolloff appears in the stopband.
Chebyshev II filters have the same advantage over Butterworth filters that Chebyshev filters have—a sharper transition between the passband and the stopband with a lower order filter, resulting in a smaller absolute error and faster execution speed.
Elliptic filters have the following characteristics:
Compared with the same order Butterworth or Chebyshev filters, the elliptic filters provide the sharpest transition between the passband and the stopband, which accounts for their widespread use.
The following figure shows the frequency response of a lowpass elliptic filter.
In the previous figure, the same maximum tolerable error constrains the ripple in both the passband and the stopband. Also, even low-order elliptic filters have a sharp transition edge.
Bessel filters have the following characteristics:
You can use Bessel filters to reduce nonlinear-phase distortion inherent in all IIR filters. High-order IIR filters and IIR filters with a steep rolloff have a pronounced nonlinear-phase distortion, especially in the transition regions of the filters. You also can obtain linear-phase response with FIR filters.
The following figure shows the magnitude and phase responses of a lowpass Bessel filter.
In the previous figure, the magnitude is smooth and monotonically decreasing at all frequencies.
The following figure shows the phase response of a lowpass Bessel filter.
The previous figure shows the nearly linear phase in the passband. Also, the phase monotonically decreases at all frequencies.
Like Butterworth filters, Bessel filters require high-order filters to minimize peak error, which accounts for their limited use.
When choosing an IIR filter for an application, you must know the response of the filter. The following figure shows the magnitude and the phase responses of a bandpass elliptic IIR filter.
In the previous figure, the phase information is clearly nonlinear. When deciding whether to use an IIR or FIR filter to process data, remember that IIR filters provide nonlinear phase information.
IIR filters in LabWindows/CVI have the following characteristics:
The transient response occurs because the initial filter state is zero or has values at negative indexes. The duration of the transient response depends on the filter type.
The duration of the transient response for lowpass and highpass filters equals the filter order.
delay = order
The duration of the transient response for bandpass and bandstop filters equals twice the filter order.
delay = 2 × order
You can eliminate the transient response on successive calls to IIRFiltering by enabling state memory.
The following figure shows the transient response and the steady state for an IIR filter.