Window Functions
Rectangular, Hamming, Hanning, Blackman windows.
The window method is the most widely used technique for designing FIR digital filters. It starts from an ideal frequency response, computes the corresponding impulse response, and then truncates it using a finite-length window sequence to make the filter realizable. Understanding window functions is essential for GATE DSP problems and practical filter design.
Core Concept Explanation
An ideal filter such as a low-pass filter has a perfectly rectangular frequency response. When you take the inverse DTFT of this response, you get an ideal impulse response that extends from negative infinity to positive infinity. This makes it non-causal and infinitely long, so it cannot be implemented directly on a digital processor.
The window method solves this by multiplying the ideal impulse response with a finite-duration window sequence. This multiplication in the time domain corresponds to a convolution in the frequency domain, which means the sharp edges of the ideal frequency response get smoothed out. The nature of this smoothing depends entirely on which window you choose.
The Gibbs phenomenon is the fundamental motivation for using windows other than the rectangular one. When the rectangular window truncates an ideal impulse response, the convolution of the rectangular window spectrum with the ideal response introduces oscillatory ripples near the cutoff frequency. The peak overshoot due to Gibbs phenomenon is approximately 9 percent and does not reduce even as filter length N increases. Only by using a smoother window can this ripple be suppressed.
Window Functions and Their Equations
The rectangular window is the simplest: w[n] = 1 for 0 ≤ n ≤ N-1, and zero otherwise. It gives the narrowest transition band but the worst stopband attenuation of only 21 dB, making it unsuitable for most practical filters.
The Hanning window (also called von Hann window) uses a cosine taper: w[n] = 0.5 - 0.5·cos(2πn/(N-1)). The taper smoothly reduces the impulse response values at both ends toward zero, which significantly reduces side-lobe energy and achieves about 44 dB of stopband attenuation at the cost of a wider transition band.
The Hamming window is a modified Hanning: w[n] = 0.54 - 0.46·cos(2πn/(N-1)). The coefficients 0.54 and 0.46 are chosen to minimize the maximum side-lobe level rather than making the side lobes decay. This gives a slightly better peak side-lobe of -41 dB and about 53 dB stopband attenuation compared to Hanning. Hamming is the most commonly used window in practice.
The Blackman window adds a second cosine harmonic: w[n] = 0.42 - 0.5·cos(2πn/(N-1)) + 0.08·cos(4πn/(N-1)). This extra term further suppresses side lobes and achieves approximately 74 dB stopband attenuation, but it requires a larger filter length to achieve the same transition band width. Blackman is preferred when extremely high stopband rejection is needed.
Mathematical Expression
For a low-pass FIR filter with cutoff frequency ωc, the ideal impulse response is given by h_d[n] = ωc/π · sinc(ωc·(n - α)/π) where α = (N-1)/2 is the delay required to make the filter causal. The actual FIR filter coefficients are obtained by h[n] = h_d[n] · w[n] for n = 0 to N-1. The filter length N is determined from the required transition bandwidth Δω using window-specific formulas. For Hamming window, N ≈ 8π/Δω, and for Blackman window, N ≈ 12π/Δω. A larger N always results in a sharper transition but increases computational cost.
Practical Understanding
In practice, the choice of window is driven by two competing specifications: the stopband attenuation requirement and the allowable transition bandwidth. If the application demands very high attenuation such as in audio processing or communications front ends, Blackman or Kaiser windows are chosen. If a narrow transition band is more important, Hamming is preferred over Blackman because it achieves similar attenuation with a shorter filter length.
Another important property of window-based FIR filters is that they exhibit linear phase as long as the impulse response is symmetric around its center point. Linear phase means that all frequency components experience the same time delay through the filter, which is critical in applications such as audio equalization, biomedical signal processing, and data communication where waveform shape must be preserved.
Numerical Example
To find filter length N for a Hamming window given a transition bandwidth requirement, use the formula N ≈ 8π/Δω. The transition bandwidth Δω is the difference between the passband edge and the stopband edge in radians per sample.
Given:
Passband edge: ωp = 0.4π rad/sample
Stopband edge: ωs = 0.6π rad/sample
Window chosen: Hamming
Why this formula applies:
Hamming window main lobe width = 8π/N, which defines the transition width achievable.
Formula:
N ≈ 8π / Δω
Substitution:
Δω = ωs - ωp = 0.6π - 0.4π = 0.2π
N ≈ 8π / 0.2π
Calculation:
N ≈ 8 / 0.2 = 40
Since N must be odd for symmetric FIR (Type I), round to N = 41
Final Answer:
Minimum filter length N = 41 taps
Groupdelay = (N-1)/2 = 20 samplesExam Tip: GATE often asks which window gives 44 dB attenuation. The answer is Hanning. Hamming gives 53 dB. Blackman gives 74 dB. Rectangular gives only 21 dB. Memorize these four values directly. Also note that increasing N does NOT change the stopband attenuation for a given window type, it only narrows the transition band.
Mechanism of Window Shaping
- The rectangular window has unit value for all N samples, creating an abrupt cutoff that causes maximum Gibbs oscillation in the frequency response.
- Hanning and Hamming windows taper smoothly to near-zero at both edges using a single cosine term. This smooth taper reduces energy leakage into side lobes.
- The Blackman window uses two cosine terms to create a more gradual taper, achieving even lower side lobes but at the cost of a wider main lobe and hence a wider transition band.
- For a fixed filter length N, all windows produce the same group delay of (N-1)/2 samples. This is the group delay of the linear phase FIR filter.
- Stopband attenuation is a fixed property of the window type and does NOT improve by increasing N. Only the transition bandwidth narrows when N increases.
Quick Revision
- The window method multiplies the ideal infinite impulse response h_d[n] with a finite window w[n] to get h[n] = h_d[n] · w[n].
- Rectangular window: 21 dB attenuation, narrowest transition band. Worst for stopband ripple.
- Hanning: 44 dB, Hamming: 53 dB, Blackman: 74 dB. Better attenuation always means wider transition band.
- Filter length formulas: Rectangular N ≈ 4π/Δω, Hanning/Hamming N ≈ 8π/Δω, Blackman N ≈ 12π/Δω.
- Group delay of a symmetric FIR filter = (N-1)/2 samples. This is a linear phase property.
- Gibbs phenomenon gives approximately 9 percent overshoot at the cutoff for rectangular window regardless of N.
- Exam trap: Increasing N reduces transition width but does NOT improve stopband attenuation for the same window.
Window Functions Quiz
Test your knowledge on this topic!
Q1.Which fixed window function yields the narrowest main lobe width in the frequency domain?
Related Articles
FIR Characteristics
Linear phase, stability, implementation.
5 min read
FIR Structures
Direct form, cascade, linear phase.
11 min read
Filter Types
LPF, HPF, BPF, BSF, Allpass.
10 min read
IIR Basics
Feedback, infinite impulse response.
8 min read
Impulse Invariance
Mapping s-plane to z-plane, aliasing.
10 min read