What is Window function?

A weighting function applied to a finite interval of a signal or of coefficients in DFT analysis and FIR filter design. Simply cutting out the interval (a rectangular window) leaves its two ends discontinuous and causes spectral leakage or ripple, which a window that brings both ends smoothly toward 0 suppresses. The typical Hann (Hanning) window has a highest side lobe of about −31 dB, lower than the rectangular window's −13 dB, but a main lobe about twice as wide. Hamming, Blackman, flat-top and other windows are chosen depending on whether low side lobes or a narrow main lobe matters more.

Japanese name: 窓関数

Window function appears in 1 practice question across 1 topic, including Digital Signal Processing Basics.

Field: Digital Signal Processing Basics

Main lobe and side lobes

The spectrum of a window consists of a large central peak (the main lobe) and smaller peaks on both sides (the side lobes). The narrower the main lobe, the easier it is to tell apart two components at close frequencies; the lower the side lobes, the less a weak component near a strong one gets buried. The two trade off against each other: the rectangular window has the narrowest main lobe but high side lobes, and the Hann window is the opposite.

Reading and correcting amplitudes

Applying a window reduces the signal amplitude on average, so amplitudes are corrected by dividing by the window's mean value (0.5 for the Hann window). A frequency halfway between bins is also read too small (scalloping loss), by about 3.9 dB with the rectangular window and about 1.4 dB with the Hann window. When amplitudes must be measured accurately, a flat-top window, whose main lobe has a flat top, is used.

Windows in FIR filter design

The impulse response of an ideal low-pass filter (a sinc function) continues forever, so it must be cut to a finite number of taps. Simple truncation produces ripple in the passband and stopband (the Gibbs phenomenon), but applying a window function first gives a response with suppressed ripple. The type of window changes the balance between stopband attenuation and transition-band width.

Try it: questions about Window function

Which of the following is the main cause of spectral leakage in a DFT?

  1. AThe sampling frequency is lower than twice the highest signal frequency, so high frequencies fold back onto low frequencies
  2. BWhen the number of DFT points is not a power of two, rounding errors in the FFT computation grow and spread to the surrounding bins
  3. CThe observation interval does not contain a whole number of signal periods, so the waveform is treated as if its two ends joined discontinuously
Show answer and explanation

Answer: C. The observation interval does not contain a whole number of signal periods, so the waveform is treated as if its two ends joined discontinuously

The DFT treats the N observed points as one period of a repeating signal. If the interval holds exactly a whole number of periods of a sine wave, the peak fits in a single bin; otherwise the waveform is discontinuous where the ends of the interval meet, and that energy spreads into many surrounding bins. This is spectral leakage, and it can be reduced with a window function that brings both ends of the interval smoothly toward 0. Aliasing (folding) is a different phenomenon that occurs at sampling.

FAQ

When is a window function needed?

A window is normally applied whenever there is no guarantee that the measured signal fits a whole number of periods into the observation interval. When the period matches the interval exactly, or for a transient signal that dies out within the interval, leakage is not a problem even with the rectangular window (no window).

What is the difference between the Hann and Hamming windows?

Both are cosine-shaped windows, but the Hann window goes exactly to 0 at both ends and its distant side lobes decay quickly. The Hamming window leaves about 0.08 at both ends instead of 0, which lowers its highest side lobe to about −43 dB, but its distant side lobes decay more slowly.

Window function in the explanations

Questions that mention Window function (1)

  1. Which of the following is the main cause of spectral leakage in a DFT?

Books on Digital Signal Processing Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

Spectral leakage Aliasing Convolution Decimation Difference equation Discrete Fourier transform Fast Fourier transform (FFT) FIR filter Frequency resolution Group delay

Back to the glossary