# 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.

Figure 19 (a) Three-term averaging filter; (b) input signal to the three-term averaging filter

The values of and are listed in Table 1. Assume that for any and .

## Table 1 Values of and from Figure 19(b)

| −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.

## Table 2 Results of calculations for

| −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 20 Filter output in response to the input in Figure 19(b)

Figure 21 shows the same filter applied to an input that has more noise in the signal and a longer sequence.

Figure 21 Longer sequence filtered by the three-term averaging filter (Wickert, 2011, p. 7)

## Activity 8

Allow about 5 minutes

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.

OpenLearn - Electronic applications
Except for third party materials and otherwise, this content is made available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Licence, full copyright detail can be found in the acknowledgements section. Please see full copyright statement for details.