# Windowing

Use windowing, or smoothing windows, to minimize spectral leakage associated with truncated waveforms.

## Spectral Leakage

Spectral leakage is a phenomenon whereby the measured spectral energy appears to leak from one frequency into other frequencies. It occurs when a sampled waveform does not contain an integral number of cycles over the time period during which it was sampled. The technique used to reduce spectral leakage is to multiply the time-domain waveform by a window function.

Discrete Fourier Transform (DFT) and Fast Fourier Transform (FFT) are mathematical techniques that resolve a given signal into the sum of sines and cosines. It is the basis for spectrum analysis. Using the DFT/FFT when you sample a noninteger number of cycles, such as 7.5 cycles, returns a spectrum in which it appears as if the energy at one frequency leaks into all the other frequencies because the FFT assumes that the data is a single period of a periodically repeating waveform. The artificial discontinuities appear as very high frequencies that were not present in the original signal. Because these frequencies are higher than the Nyquist frequency, they appear aliased between 0 and fs/2.

The type of window to use depends on the type of signal you acquire and on the application. Choosing the correct window requires some knowledge of the signal that you are analyzing. The following table lists common types of windows, the appropriate signal types, and example applications.

Window Signal Type and Description Applications
Rectangular (no window) Transient signals that are shorter than the length of the window; truncates a window to within a finite time interval Order tracking, system analysis (frequency response measurements) with pseudorandom excitation, separation of two tones with frequencies very close to each other but with almost equal amplitudes
Triangle Window that is the shape of a triangle General-purpose applications
Hanning Transient signals that are longer than the length of the window Often used in speech signal processing
Hamming Transient signals that are longer than the length of the window; a modified version of the Hanning window that is discontinuous at the edges Often used in speech signal processing
Blackman Transient signals; similar to Hanning and Hamming windows but adds one additional cosine term to reduce ripple General-purpose applications
Flat Top Has the best amplitude accuracy of all the windows but limits frequency selectivity Accurate, single-tone amplitude measurements with no nearby frequency components Note

In many cases, you might not have sufficient knowledge of the signal, so you need to experiment with different windows to find the best one.