Mathematically, an IIR digital filter assumes the following form:
(3) where ak and
bj are the filter coefficients
The current filter output yi depends
on the current and previous values xi – k and previous output yi – k. If
Filters implemented directly using the structure Equation (3) defines are known as direct-form IIR filters. Direct-form implementations are often sensitive to errors introduced by coefficient quantization and by computational precision limits. Also, a filter designed to be stable can become unstable with increasing coefficient length, which is proportional to filter order.
A less-sensitive structure can be obtained by breaking up the direct-form transfer function into lower-order sections, or filter stages. The direct-form transfer function of the filter given by Equation (3) (with a0 = 1) can be written as a ratio of z transforms, as follows:
By factoring the previous equation into second-order sections, the transfer function of the filter becomes a product of second-order filter functions:
where is the largest integer
, and
Nb
This new filter structure can be described as a cascade of second-order filters, as shown in the following figure.
Cascaded Filter Stages
Each individual stage is implemented using the direct-form II filter structure because it requires a minimum number of arithmetic operations and a minimum number of delay elements, or internal filter states. Each stage has one input, one output, and two past internal states:
(sk[i – 1] and sk[i – 2]).
If n is the number of samples in the input sequence, the filtering operation proceeds as in the following equations:
y0[i] = x[i]
y[i] = yNs[i]
for each sample i = 0, 1, 2, . . ., n – 1
For lowpass and highpass filters with a single cutoff frequency, second-order filter stages can be designed directly. The overall IIR lowpass or highpass filter contains cascaded second-order filters.
For bandpass and bandstop filters with two cutoff frequencies, fourth-order filter stages are a more natural form. The overall IIR bandpass or bandstop filter contains cascaded fourth-order filters. The filtering operation for fourth-order stages proceeds as in the following equations:
y0[i] = x[i]
y[i] = yNs[i]
Notice that in the case of fourth-order filter stages, .
The IIR filters provided in the LabWindows/CVI Advanced Analysis Library are derived from analog filters. There are four major types of IIR filters:
Lowpass, highpass, bandpass, and bandstop filters exist for each type of filter. The frequency response of a Butterworth filter is characterized by a smooth response at all frequencies and a monotonic decrease from the specified cut-off frequencies. Butterworth filters are maximally flat in the passband and zero in the stopband. The rolloff between the passband and stopband is slow, so a lower-order Butterworth filter does not provide a good approximation of an ideal filter.
Chebyshev filters have equal ripples in the passband and a monotonically decreasing magnitude response in the stopband. These filters have much sharper rolloffs than Butterworth filters. The inverse Chebyshev filters are similar to Chebyshev filters except that the ripple occurs in the stopband and the frequency response is flat in the passband.
If ripples are allowable in both the passband and the stopband, use elliptic filters. Elliptic filters have the sharpest rolloffs for the same order compared with Butterworth or Chebyshev filters.