Using Windows
The smearing or leakage effect mentioned previously is a direct consequence of the definition of the Discrete Fourier Transform and of the fact that a finite time sample of a signal often does not include an integral number of some of the frequency components in the signal. The effect of this truncation can be reduced by increasing the length of the time sequence or by employing a windowing algorithm. IDL's HANNING function computes two windows which are widely used in signal processing: the Hanning window and the Hamming window.
Hanning Window
The Hanning window is defined as:
The resulting vector is multiplied element-by-element with the sampled signal vector before applying the FFT. For example, the following IDL command computes the Hanning window and then applies the FFT function:
The power spectrum of the Hanning windowed signal shows the mitigation of the truncation effect (see the figure below).
|
![]()
|
Example Code
Type @sigprc06 at the IDL prompt to run the batch file that creates this display. The source code is located in sigprc06, in the examples/doc/signal directory. See Running the Example Code if IDL does not find the batch file.
Hamming Window
The Hamming window is defined as:
The resulting vector is multiplied element-by-element with the sampled signal vector before applying the FFT. For example, the following IDL command computes the Hamming window and then applies the FFT function:
The power spectrum of the Hamming windowed signal shows the mitigation of the truncation effect (see the figure below).
Example Code
Type @sigprc07 at the IDL prompt to run the batch file that creates this display. The source code is located in sigprc07, in the examples/doc/signal directory. See Running the Example Code if IDL does not find the batch file.

