When data is captured, a 'window' is effectively opened on the signal to view the waveform for a period before the 'window' is closed again. Before and after the window is open, the FFT calculation has no idea about the value of the signal. For example, the four waveforms shown right contain the same captured data (shown in grey) but have different frequency contents.
An FFT assumes that the data sequence is part of a signal that repeats periodically as illustrated by the sawtooth waveform on the lower right of the above diagram. The consequence of assuming a periodic continuation of the underlying signal is that if the amplitude at the start and the end of the sample of data are not equal then the signal will be analyzed to contain a discontinuity, whether the signal has such a discontinuity or not. Since sharp discontinuities have broad frequency spectra, these will cause the signal's frequency spectrum to be spread out. The spreading means that signal energy that should be concentrated only at one frequency, instead, leaks into all the other frequencies. This spreading of energy is called 'spectral leakage'. Since spectral leakage is related to discontinuities at the ends of the measurement time, it will be worse for signals that happen to fall such that there are large discontinuities
This is a problem since the FFT will only be an accurate calculation of the frequency content if the captured data is one or more complete cycles of a periodic underlying signal. This is normally not the case.
In order to improve the accuracy of the FFT, it is normal practice to multiply the sampled data by a window function before implementing the FFT. This window function is a series of numbers that are usually symmetrical with the mid-point of the sample time range and have a mid-point value of one e.g. the Triangle or Bartlett window.
A number of window functions are possible including a Rectangular Window that does not actually change the data at all. Some of the window functions provided are:
In order to compare the different windows, they may be plotted on the same axis as follows:
The choice of window function is usually made after some experience processing the type of signals being used. However, some guidelines can be given:
- Use a rectangular window for transient signals;
- Hann (von Hann) and Hamming for continuous waveform data;
- Rectangular (Flattop) for accurate amplitude measurements or
- Blackman for maximum frequency resolution.