# Convolution and Time Domain Filtering

Cuthbert Nyack
The above diagram shows the equivalence between the time and frequency domains. Passing a signal through a filter is equivalent to taking the convolution of the input signal with the impulse response of the filter.
Fn = 1 in the applet below shows a noisy sine being convolved with the impulse response of a filter. Since the sine has a single frequency, then a band pass filter centered at the frequency of the sine is used. The bandwidth of the filter can be modified by W but its effect is limited because the impulse response is windowed with a raised cosine to reduce 'edge' effects in the convolution.
Fn = 2 to 5 show special cases of Fn = 1.
Fn = 6 is the case with 2 sinusoids. Here the filter and impulse response used can be set by 'C'. C = 1 uses 2 bandpass filters centered at w and w1. This filter can be used to reduce the noise while passing both frequencies. To pass only w, C = 0 and C = 2 to pass w1.
Fn = 7 to 13 show special cases of Fn = 6.
Fn = 14 shows the case of an AM signal with modulating index 'm' carrier frequency w and modulating frequency w1. A bandpass filter is used.
Fn = 15 to 18 show special cases of Fn = 14.
For Fn = 17 a narrow BW filter is used which reduces the sidebands.
Fn = 19 shows the case of a DSB signal with carrier frequency w and modulating frequency w1.
Fn = 20 to 21 show special cases of Fn = 19.
For Fn = 21 a narrow BW filter is used which reduces the sidebands.
Fn = 22 shows the case of an AM signal with modulating index 'm' carrier frequency w and modulating frequency w1. A double bandpass filter is used which can pass the 2 sidebands and reduce the carrier.
Fn = 23 to 24 show special cases of Fn = 22. Both cases show the AM being converted to a DSB signal.
Fn = 25 shows the case of an PM signal with modulating index 'm1' carrier frequency w and modulating frequency w1. A bandpass filter is used.
Fn = 26 to 28 show special cases of Fn = 25. Fn = 27 uses a narrow bandpass filter which only passes the carrier.
Fn = 29 shows the case of a square wave and a low pass filter.
Fn = 30 to 34 show special cases of Fn = 29.
Fn = 35 shows the case of a square wave and a band pass filter.
Fn = 36 to 43 show special cases of Fn = 35 corresponding to nh = 1, 2, 3, 4, 5, 6, 7 and 9. nh sets the center frequency of the bandpass filter at the harmonic nh w.
In this case convolution is used as a spectrum analyser to find the spectral components of the square wave.
Fn = 44 shows the case of a rectangular wave and a band pass filter.
Fn = 45 to 55 show special cases of Fn = 44 corresponding to nh = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11. nh sets the center frequency of the bandpass filter at the harmonic nh w.
In this case convolution is used as a spectrum analyser to find the spectral components of the rectangular wave.
Fn = 56 shows the case of a triangle wave and a low pass filter.
Fn = 57 to 58 show special cases of Fn = 56.
Fn = 59 shows the case of 2 triangle waves with fundamental frequencies w and w1 and with overlapping spectra. Individual waves are in pale yellow and their resultant in red. To separate the 2 a comb filter with a |cos| frequency response is used. The impulse response of this filter is shown in orange. In this case the the comb is set to pass components at nw ie the higher frequency triangle wave.
Fn = 60 shows the case where the comb is set to pass components at nw1 ie the lower frequency triangle wave.
Fn = 61, 62 and 63, 64 show the same effect with slightly different number of zeros for the comb filter.
Fn = 65 shows the frequency response of the |cos| comb filter used above and a comb filter consisting of a series of rectangles. The latter should be less sensitive to noise. However when the impulse response is windowed the frequency response becomes broader than that shown.
Fn = 66 to 72 show special cases of the latter comb filter.

Image below shows the noise in the green signal removed by convolving it with the impulse response of a double band pass filter in orange. Cyan curve shows the result of the convolution. Convolving the clean red signal with the orange impulse response results in the pink signal.

The possibility of separating 2 frequency overlapping triangle waves by convolution with the impulse response of a comb filter is illustrated by the image below.
Red signal shows the sum of the 2 triangles. When it is convolved with the orange impulse response, the result is the pink triangle wave. When the noisy version of the red signal shown in green is convolved with the orange signal, the result is shown in cyan.
Note that the magnitude of the impulse response of the comb filter is the same as the optical pattern obtained from a multislit aperture.

Changing the response of the comb filter results in the other triangle as shown below.