Pass Data through a Window

DN Staff

November 5, 2007

3 Min Read
Pass Data through a Window

Many engineers understand the need to pass signals through an anti-alias filter prior to digitizing them. But they may neglect to apply a window function to their data prior to using a fast Fourier transform (FFT). The lack of a window can distort results and cause you to draw incorrect conclusions about test and experiment data.

If you run a sine wave (Figure A) through an FFT, the resulting magnitude versus frequency plot would show a single point that, in this case, indicates a frequency of 1,600 Hz. Unfortunately, not all results appear this clean. Figure B shows a sampled 1,750-Hz sine wave and Figure C shows the FFT results. (In these figures, magnitude refers to the absolute value of the complex coefficients produced by the FFT.) Keep in mind an FFT displays results in discrete frequency "bins" that occur only at integer multiples of the sampling frequency (51,200 samples/sec) divided by the number of points acquired (512). So, no bin exists at precisely 1,750 Hz and you see results at 1,700 and 1,800 Hz.

Figure C shows some "leakage" into several adjacent frequency bins. That leakage occurs because an FFT needs to process an infinitely long continuous function, but we provide only a finite number of samples. If you cut and paste the 1,600-Hz waveform head-to-tail, you get a continuous waveform. But if do the same thing with the 1,750-Hz signal, you see a discontinuity at each head-to-tail junction. This discontinuity causes the leakage. Sometimes, leakage from a high-amplitude signal can swamp low-amplitude signals you want to detect. You cannot eliminate leakage, but by applying window functions to your data, you can reduce it.

Raw data exists within a rectangular "window" that occurs simply because you sample data over a finite time. Other windows functions attenuate information at the start and end of your sample to reduce potential head-to-tail discontinuities. Thus, windowing functions adjust your data to appear more like a continuous signal to an FFT.

Many data-analysis programs such as LabVIEW, MATLAB and Origin include FFT window functions. You also can run an FFT in Microsoft Excel, but you must write your own window functions. Useful window functions include Hanning, Hamming, Blackman and Kaiser-Bessel, each of which suit different needs. Figure D shows how a Hamming window reduced the leakage in the FFT results for the 1,750 Hz signal. Use the Web links below to find more information about window types, equations and suitability for your applications.

Sign up for the Design News Daily newsletter.

You May Also Like