3.5 Digital filtering in the time domain
A simple form of digital filter is the three-term averaging filter, in which the output value is equal to the average of three successive signal sample values. In Figure 19(a), which shows a discrete-time signal applied to a digital three-term averaging filter, the output is given by
The signals and are spaced seconds apart in time, where is the sampling interval. Similarly, and are spaced seconds apart.
Figure 19(b) shows the values of the input signal that will be applied to the filter input.
The values of and are listed in Table 1. Assume that for any and .
−3 | −2 | −1 | 0 | 1 | 2 | 3 | 4 | 5 | |
0 | 0 | −1 | 2 | 4 | 6 | 4 | 0 | 0 |
For the output to be calculated, the values of , and must be stored in memory and accessible to the processor performing the calculation. The order of a digital filter is the number of previous inputs (stored in the processor’s memory) used to calculate the current output, so this three-term averaging filter is second-order.
For values of the output will be 0, so the calculations below start at .
For you can substitute in values to give .
For you get .
For you get .
Table 2 shows the results of all calculations for , shown as decimal values to 2 significant figures. Note that you can stop at , since above this the output will be 0 again.
−3 | −2 | −1 | 0 | 1 | 2 | 3 | 4 | 5 | |
0 | 0 | −1 | 2 | 4 | 6 | 4 | 0 | 0 | |
0 | 0 | −0.33 | 0.33 | 1.67 | 4.00 | 4.67 | 3.33 | 1.33 |
The resulting output discrete-time waveform is given in Figure 20.
Figure 21 shows the same filter applied to an input that has more noise in the signal and a longer sequence.
Activity 8
Looking at Figure 21, describe the effect that the three-term averaging filter has on the output. What kind of filter is this?
Answer
The three-term averaging filter has removed the short-term fluctuations in the signal to show the longer-term trend. This is akin to removing higher-frequency noise from a signal, so it is operating like a low-pass filter.
This digital filter is an example of a system that is both linear and time-invariant, sometimes referred to as an LTI system.
You can see that the three-term averaging filter is a low-pass filter, but it is difficult to characterise its response. For example, what frequencies is the filter eliminating from the signal? Earlier in this course, you saw how analogue filters can be designed to give a desired frequency response; now you will look at how digital filters can also be designed in the frequency domain.
Filters are usually described in terms that make sense in the frequency domain, e.g. a low pass filter allows the parts of the signal with low frequencies to pass. In the following section you will see how a digital filter is designed in the frequency domain.