Interactive Educational Modules in
Scientific Computing

Digital Filtering

This module shows how the discrete Fourier transform (DFT) can be used to filter noise from a sequence. Among the many applications of the DFT in engineering and computer science, signal processing is one of the most prominent. One such application is filtering spurious noise from transmitted signals. This module demonstrates how digital filtering works in a relatively simple setting.

The upper graph shows a sequence of values (blue dots) sampled from a continuous function (green). The user selects the source function and the number of samples using the menus provided. To remove noise from the sampled values, the DFT is applied to the sequence, the highest frequency components are removed from the transformed sequence, and then the inverse DFT is applied to return to the original domain. The resulting smoothed signal is displayed in the lower graph. The number of frequencies suppressed, from highest to lowest, is determined using the slider provided. Note that when only one frequency remains, the sequence is a constant (equal to the mean of the original sequence), and when no frequencies remain, the sequence becomes zero, as no information remains about the original sequence.

The Random Noise and Systematic Noise buttons introduce noise into the basic signal. The user can gauge the effectiveness of the noise reduction by introducting noise into the original signal and comparing the filtered signal to the source function for various amounts of truncation. The Random Noise button randomly perturbs the original data points. The Systematic Noise button adjusts the frequencies in the DFT sequence, modifying the frequencies randomly but with high frequencies perturbed more than low frequencies, representing the fact that transmitted signals are usually subject to more high frequency noise than low frequency noise. The noise level slider scales the amount of noise introduced by these two buttons. The Reset button returns the base signal to its original state, a discrete sampling of the source function.

Some of the source functions, such as the constant function and the cosine function, produce sequences having only low frequencies in their DFTs. For those functions, almost all of the high frequencies can be suppressed without introducing error in the modified sequence, and noise can be nearly eliminated by truncating high frequencies. Other source functions include higher frequency components initially, and are difficult to represent accurately without retaining most or all frequencies. In the step function, for example, the Gibbs phenomenon can be seen by truncating some of the high frequencies in the original signal. For initial sequences that contain some high frequencies, it is more difficult to remove noise and still maintain a good representation of the original signal.

Reference: Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Section 12.3 and Computer Problem 12.11 on page 509.

Developers: Evan VanderZee and Michael Heath