Monday, July 20, 2009

Example of a recursive filter

A simple example of a recursive digital filter is given by

yn = xn + yn-1

In other words, this filter determines the current output (yn) by adding the current input (xn) to the previous output (yn-1).

Thus:

y0 = x0 + y-1
y1 = x1 + y0
y2 = x2 + y1
y3 = x3 + y2
... etc

Note that y-1 (like x-1) is undefined, and is usually taken to be zero.

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 = x0
y1 = x1 + y0 = x1 + x0
y2 = x2 + y1 = x2 + x1 + x0
y3 = x3 + y2 = x3 + x2 + x1 + x0
... etc

Thus we can see that yn, the output at t = nh, is equal to the sum of the current input xn and all the previous inputs. This filter therefore sums or integrates the input values, and so has a similar effect to an analog integrator circuit.

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

This would necessitate many more addition operations, as well as the storage of many more values in memory.

No comments:

Post a Comment