18.3.2 Algorithms (IIR Filters)

IIR (Infinite Impulse Response) filter is a digital filter with feedback, as showing in the following picture.

IIR Filter 1.png

Digital filter is also often described in the difference equation form, which defines the relationship between output signal and input signal.

\[b_0*x(n)+b_1*x(n-1)+ \cdots +b_N*x(n-N)-a_0*y(n)-a_1*y(n-1)- \cdots -a_M*y(n-M) = 0 \]

then get

\[y(n) = \frac{1}{a_0} \left ( b_0*x(n)+b_1*x(n-1)+ \cdots +b_N*x(n-N)-a_1*y(n-1)-a_2*y(n-2)- \cdots -a_M*y(n-M) \right ) = \frac{1}{a_0} \left ( \sum_{i=0}^N b_i*x(n-i) - \sum_{j=1}^M a_j*y(n-j) \right )\]

where \(a_0 \ne 0\), N is the feedforward filter order, \(b_i\) is the feedforward filter coefficient, M is the feedback filter order, \(a_i\) is the feedback coefficient, x(n) is the input signal, and y(n) is the output signal. The term \(\sum_{j=1}^M a_j*y(n-j)\) is the feedback.

Digital Filter Representation

In Origin, there are four outputs for representation of IIR filter.

How to Design IIR Filter

The typical procedure to design IIR filter is:

  1. Specify filter specification.
  2. Specify low pass analog filter prototype, and the available prototypes supported in Origin include Butterworth, Chebyshev Type I, Chebyshev Type II, and Elliptic.
  3. Method Squared Magnitude Response Function Analog Filter Transfer Function
    Butterworth \[|H_a(j \Omega)|^2 = \frac{1}{1+ \Omega^{2N}}\] \[H_a(s) = \frac{q(s)}{p(s)} = \frac{g}{(s-p_1)(s-p_2)\cdots (s-p_N)} = \frac{g}{\prod_{k=1}^N (s-p_k)}\]
    Chebyshev Type I \[|H_a(j \Omega)|^2 = \frac{1}{1+ \varepsilon^2 T_N^2(\Omega)}\] \[H_a(s) = \frac{q(s)}{p(s)} = \frac{g}{(s-p_1)(s-p_2)\cdots (s-p_N)} = \frac{g}{\prod_{k=1}^N (s-p_k)}\]
    Chebyshev Type II \[|H_a(j \Omega)|^2 = \frac{1}{1+ (\varepsilon^2 T_N^2(\frac{1}{\Omega}))^{-1}} = \frac{\varepsilon^2 T_N^2(\frac{1}{\Omega})}{1+ \varepsilon^2 T_N^2(\frac{1}{\Omega})}\] \[H_a(s) = \frac{q(s)}{p(s)} = g \frac{(s-q_1)(s-q_2)\cdots (s-q_N)}{(s-p_1)(s-p_2)\cdots (s-p_N)} = g \prod_{k=1}^N \frac{(s-q_k)}{(s-p_k)}\]
    Elliptic \[|H_a(j \Omega)|^2 = \frac{1}{1+ \varepsilon^2 U_N^2(\Omega)}\] \[H_a(s) = \frac{q(s)}{p(s)} = g \frac{(s-q_1)(s-q_2)\cdots (s-q_N)}{(s-p_1)(s-p_2)\cdots (s-p_N)} = g \frac{\prod_{i=1}^N (s-q_i)}{\prod_{j=1}^N (s-p_j)}\]

    In the table above, \(\Omega\) is the frequency, N is the filter order, \(\varepsilon\) is the maximum oscillation in the passband frequency response, \(T_N\) is the Chebyshev polynomial, \(U_N\) is the Jacobian elliptic function, g is the scalar gain, s is the plane of Laplace transform, \(q_k\) or \(q_i\) is the zero, and \(p_k\) or \(p_j\) is the pole.

  4. Frequency transform for analog filter
  5. Transform the low pass filter into a high pass, band pass, or band stop filter with desired cutoff frequency. In Origin, the state-space form will be used in the frequency transform calculation. Assume the original transfer function of the low pass filter is \(H(s')\), and the transfer function after transform is \(H(s)\).

    where \(\omega_0 = sqrt(\omega_1*\omega_2)\) is the center frequency, \(B_\omega = \omega_2 - \omega_1\) is the bandwidth, \(\omega_1\) and \(\omega_2\) are the lower and upper band edges respectively.

  6. Convert analog filter into a digital filter.
  7. To convert analog filter into a digital filter, Origin uses the bilinear transformation, which is defined by expression:

    \[s = \frac{1-z^{-1}}{1+z^{-1}}\]

Forward and Backward Filtering

Origin allows to perform the forward and backward filtering, which will result to zero-phase distortion. First of all, it will perform filtering the data in the forward direction, and then reverses the filtered data, then runs it back through the filter again.