Filtering

The time window of y[n] in equation (3.1) is very short (4 samples), so its effects are very local. To smooth over a larger slice of the signal, we can do two things:

 a) increase the number of samples in x[n] ... x [n-m] in the formula for y[n].
 b) make y[n] depend in part on its own previous value (y[n-1]) or several previous values.

A filter of the second kind has the general form:
 
(3.2)    y[n] = b 0x[n] + b1 x[ n-1] + b2 x[n -1] + ... + bk x[n - k
- a1 y[n-1] + .... + aj y[n-j]

(In the moving average example, b0 = b1 = b 2 = b3 = 0.25 and all an = 0).

This kind of filter is called an IIR Filter. (IIR stands for Infinite Impulse Response. Sometimes they are called recursive filters.) If all an = 0 (i.e. if previous values of y are disregarded) the filter is called FIR (Finite Impulse Response). IIR filters are a bit more efficient to implement, because they require fewer terms in order to work as well as FIR filters.

By varying the a's, b's, and the number and spacing of previous x and y samples, a variety of filters with various kinds of frequency­selecting behaviours can be constructed. It is requires some rather advanced mathematics to calculate what the a's and b 's have to be to filter out a desired range of frequencies (we shall see an example shortly). Alternatively, you can get the values from tables: click here for low-pass filter coeffients , or here for high-pass filter coefficients .

Next: Spectral analysis