For all the examples of digital filters discussed so far, the current output (yn) is calculated solely from the current and previous input values (xn, xn-1, xn-2, ...). This type of filter is said to be non-recursive.
A recursive filter is one which in addition to input values also uses previous output values. These, like the previous input values, are stored in the processor's memory.
The word recursive literally means "running back", and refers to the fact that previously-calculated output values go back into the calculation of the latest output. The expression for a recursive filter therefore contains not only terms involving the input values (xn, xn-1, xn-2, ...) but also terms in yn-1, yn-2, ...
From this explanation, it might seem as though recursive filters require more calculations to be performed, since there are previous output terms in the filter expression as well as input terms. In fact, the reverse is usually the case. To achieve a given frequency response characteristic using a recursive filter generally requires a much lower order filter, and therefore fewer terms to be evaluated by the processor, than the equivalent non-recursive filter. This will be demonstrated later.
Note: FIR and IIR filtersSome people prefer an alternative terminology in which a non-recursive filter is known as an FIR (or Finite Impulse Response) filter, and a recursive filter as an IIR (or InfiniteImpulse Response) filter. These terms refer to the differing "impulse responses" of the two types of filterThe impulse response of a digital filter is the output sequence from the filter when a unit impulse is applied at its input. (A unit impulse is a very simple input sequence consisting of a single value of 1 at time t = 0, followed by zeros at all subsequent sampling instants). An FIR filter is one whose impulse response is of finite duration. An IIR filter is one whose impulse response (theoretically) continues for ever, because the recursive (previous output) terms feed back energy into the filter input and keep it going. The term IIR is not very accurate, because the actual impulse responses of nearly all IIR filters reduce virtually to zero in a finite time. Nevertheless, these two terms are widely used. |
Example of a recursive filter
A simple example of a recursive digital filter is given by- Thus:
- y0 = x0 + y-1y1 = x1 + y0y2 = x2 + y1y3 = x3 + y2... etc
- Let us consider the effect of this filter in more detail. If in each of the above expressions we substitute for yn-1 the value given by the previous expression, we get the following:
- y0 = x0 + y-1 = x0y1 = x1 + y0 = x1 + x0y2 = x2 + y1 = x2 + x1 + x0y3 = x3 + y2 = x3 + x2 + x1 + x0... etc
This example demonstrates an important and useful feature of recursive filters: the economy with which the output values are calculated, as compared with the equivalent non-recursive filter. In this example, each output is determined simply by adding two numbers together.
- For instance, to calculate the output at time t = 10h, the recursive filter uses the expression
- y10 = x10 + y9
- To achieve the same effect with a non-recursive filter (i.e. without using previous output values stored in memory) would entail using the expression
- y10 = x10 + x9 + x8 + x7 + x6 + x5 + x4 + x3 + x2 + x1 + x0
Order of a recursive (IIR) digital filter
The order of a digital filter was defined earlier as the number of previous inputs which have to be stored in order to generate a given output. This definition is appropriate for non-recursive (FIR) filters, which use only the current and previous inputs to compute the current output. In the case of recursive filters, the definition can be extended as follows:- The order of a recursive filter is the largest number of previous input or output values required to compute the current output.
- For example, the recursive filter discussed above, given by the expression
- yn = xn + yn-1
In practice, recursive filters usually require the same number of previous inputs and outputs. Thus, a first-order recursive filter generally requires one previous input (xn-1) and one previous output (yn-1), while a second-order recursive filter makes use of two previous inputs (xn-1 and xn-2) and two previous outputs (yn-1 and yn-2); and so on, for higher orders.
Note that a recursive (IIR) filter must, by definition, be of at least first order; a zero-order recursive filter is an impossibility. (Why?)
Coefficients of recursive (IIR) digital filters
From the above discussion, we can see that a recursive filter is basically like a non-recursive filter, with the addition of extra terms involving previous outputs (yn-1, yn-2 etc.).A first-order recursive filter can be written in the general form