S7 · Lesson 22 · FIR design by windowing
Truncating the ideal impulse response, how the window's spectrum sets ripple and transition width, the classic windows, and Kaiser's design formulas
The ideal lowpass filter's impulse response is known exactly, a sinc, but it's infinitely long. Cutting it off gives a realizable FIR filter, and the way it's cut off decides how good that filter is. Chopping abruptly leaves the Gibbs ripple of lesson 1: 9% overshoot, about 21 dB of stopband rejection, however many taps are used. Tapering the cut with a smooth window trades a wider transition band for much smaller ripple. Kaiser's window turns that trade into two formulas that give the length and shape needed to meet a specification directly.
- The spectra of three windows of length M + 1 in dB: rectangular, Hamming and Blackman, each computed exactly as a sum of shifted Dirichlet kernels.
- The rectangular window has the narrowest main lobe but sidelobes only 13 dB down; Hamming's are 42 dB down and Blackman's 58 dB, with main lobes two and three times as wide.
- Increasing M narrows every main lobe without lowering any sidelobe: length buys sharpness, while the window's shape buys rejection.
Predict
A rectangular-window lowpass design gives only 21 dB of stopband attenuation. Will doubling the number of taps improve it?
No. The filter's response is the ideal response smoothed by the window's spectrum, and the ripple comes from the window's sidelobes, whose level relative to the main lobe is fixed by the window's shape, about −13 dB for the rectangle, giving roughly −21 dB of stopband error after integration. More taps only make the main lobe, and so the transition band, narrower. Better rejection needs a different window.
Name it
Windowing the ideal response
For a lowpass with cutoff and delay α = M/2:
The designed response is the ideal one convolved (periodically) with : the window's main-lobe width sets the transition width, and its sidelobes set the ripple, which is about the same in passband and stopband ().
| Window | Peak sidelobe | Main-lobe width | Peak error, 20 log δ |
|---|---|---|---|
| Rectangular | −13 dB | 4π/(M + 1) | −21 dB |
| Hann | −31 dB | 8π/M | −44 dB |
| Hamming | −41 dB | 8π/M | −53 dB |
| Blackman | −57 dB | 12π/M | −74 dB |
(Oppenheim and Schafer's Table 7.2.) The transition width of the designed filter is roughly the main-lobe width, a little less.
The Kaiser window
has a shape parameter β. For a stopband attenuation and transition width :
with midway between and .
Worked example
Design a Kaiser lowpass with = 0.4π, = 0.6π and = 0.001.
Show the solution
- Attenuation and transition. A = 60 dB and Δω = 0.2π.
- Shape parameter.
- Order. so M = 37 (38 taps).
- Cutoff. Put midway, at 0.5π.
- Check. This is Oppenheim and Schafer's Example 7.8; the finished filter meets the specification with a little to spare.
Answer β = 5.653, M = 37 (38 taps) and = 0.5π.
Worked example
Designing for the same 0.2π transition with a Hamming window: how long is it, and how much rejection does it give?
Show the solution
- Length. Hamming's main lobe is 8π/M wide, so a transition of about 0.2π needs a little more than Kaiser's 37.
- Rejection. Hamming gives a fixed −53 dB, short of the 60 dB required.
- Why Kaiser wins. Kaiser's adjustable β is what lets it hit exactly the rejection needed with the shortest length.
Answer M ≈ 40, with a fixed 53 dB of rejection, short of the 60 dB required.
Worked example
A lowpass needs about 44 dB of rejection and a 0.1π transition. Compare a Hann design with a Kaiser design.
Show the solution
- Hann. Hann's main lobe is 8π/M wide, so for its fixed −44 dB peak error.
- Kaiser's β for A = 44.
- Kaiser's order. so M = 51.
- Compare. The Kaiser window reaches the same rejection with about 40% fewer taps, because its β can be set for exactly the attenuation needed instead of a fixed window's.
Answer Hann needs M = 80; Kaiser needs M = 51 (β = 3.86), about 40% fewer taps.
Check
A Kaiser design needs 60 dB of stopband attenuation. What β?
Check
A Kaiser design needs only 40 dB. What β?
Check
A Kaiser design needs 60 dB with a transition width of 0.05π. What does the formula give for M (before rounding up)?
Check
A length-(M + 1) lowpass with M = 36 and cutoff 0.35π: what's the ideal coefficient ?
Check
What's the Hamming window's value at n = 5 for M = 50?
Check
A Blackman-window design must have a transition width of about 0.1π. Roughly what M does that take, using the main-lobe width?
Check
A lowpass needs about 44 dB of rejection with a 0.1π transition.
(a)
What order does a Hann window need (main lobe 8π/M)?
(b)
What order does Kaiser's formula give for 44 dB?
Check
A length-(M + 1) Hamming-window lowpass with cutoff cπ is evaluated at tap n (n ≠ M/2).
Step 1
What is the ideal coefficient ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
What is the Hamming window there?
Step 3
What is the designed coefficient?
Explain why
Why does tapering the window lower the ripple but widen the transition band?
Multiplying the ideal impulse response by a window means the designed frequency response is the ideal brick-wall response convolved with the window's spectrum. Every bump of that spectrum, as it slides across the brick wall's edge, adds a little wiggle to the result, so the sidelobes of the window become the ripple of the filter, and the main lobe's width sets how gradually the response falls from passband to stopband. A rectangular window has the narrowest possible main lobe for its length, but its abrupt ends give it high sidelobes. Tapering the ends smooths the window, which spreads its spectrum's energy into a wider main lobe and drains the sidelobes. The filter gets less ripple and a slower transition, and only more taps can narrow it again.
Practice
Keep practicing
10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.