# Common Digital Filters

You can classify a digital filter as one of the following types:

- Finite impulse response (FIR) filter, also known as moving average (MA) filter
- Infinite impulse response (IIR) filter, also known as autoregressive-moving average (ARMA) filter

Traditional filter classification begins with classifying a filter according to its impulse response.

## Impulse Response

An impulse is a short duration signal that goes from zero to a maximum value and back to zero again in a short time. The following set of equations provides the mathematical definition of an impulse.

x0 = 1 xi = 0 | (A)

for all i ≠ 0.

The impulse response of a filter is the response of the filter to an impulse and depends on the values upon which the filter operates. The following figure illustrates impulse response.

The Fourier transform of the impulse response is the frequency response of the filter. The frequency response of a filter provides information about the output of the filter at different frequencies. In other words, the frequency response of a filter reflects the gain of the filter at different frequencies. For an ideal filter, the gain is one in the passband and zero in the stopband. An ideal filter passes all frequencies in the passband to the output unchanged but passes none of the frequencies in the stopband to the output.

## Classifying Filters by Impulse Response

The impulse response of a filter determines whether the filter is an FIR or IIR filter. The output of an FIR filter depends only on the current and past input values. The output of an IIR filter depends on the current and past input values and the current and past output values.

The operation of a cash register can serve as an example to illustrate the difference between FIR and IIR filter operations. For this example, the following conditions are true:

- x[k] is the cost of the current item entered into the cash register.
- x[k – 1] is the price of the past item entered into the cash register.
- 1 ≤ k ≤ N
- N is the total number of items entered into the cash register.

The following statements describe the operation of the cash register:

- The cash register adds the cost of each item to produce the running total y[k].
- The following equation computes y[k] up to the kth item.

  y[k] = x[k] + x[k – 1] + x[k – 2] + x[k – 3] + … + x[1] | (B)

  Therefore, the total for N items is y[N].
- y[k] equals the total up to the kth item.
  y[k – 1] equals the total up to the (k – 1) item.
  Therefore, Equation B can be rewritten as the following equation.

  y[k] = y[k – 1] + x[k] | (C)

- Add a tax of 8.25% and rewrite Equations B and C as the following equations.

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

  y[k] = y[k – 1] + 1.0825 x[k] | (E)

Equations D and E identically describe the behavior of the cash register. However, Equation D describes the behavior of the cash register only in terms of the input, while Equation E describes the behavior in terms of both the input and the output. Equation D represents a non-recursive, or FIR, operation. Equation E represents a recursive, or IIR, operation.

Equations that describe the operation of a filter and have the same form as Equations B, C, D, and E are difference equations.

FIR filters are the simplest filters to design. If a single impulse is present at the input of an FIR filter and all subsequent inputs are zero, the output of an FIR filter becomes zero after a finite time. Therefore, FIR filters are finite. The time required for the filter output to reach zero equals the number of filter coefficients.

Because IIR filters operate on current and past input values and current and past output values, the impulse response of an IIR filter never reaches zero and is an infinite response.

### Filter Coefficients

In Equation D, the multiplying constant for each term is 1.0825. In Equation E, the multiplying constants are 1 for y[k – 1] and 1.0825 for x[k]. The multiplying constants are the coefficients of the filter. For an IIR filter, the coefficients multiplying the inputs are the forward coefficients. The coefficients multiplying the outputs are the reverse coefficients.