FIR filter design
Introduced| English | Meaning |
|---|---|
| FIR | A linear filter with a finite-duration impulse response. |
| phase/feɪz/ | phase |
| Hamming window | A tapered cosine window reducing spectral sidelobes at the cost of a wider main lobe than a rectangular window. |
The filter you can prove things about
- The FIR 有限脉冲响应 filter is always stable, because it has no feedback.
- With symmetric taps its phase is exactly linear, so it delays passband frequencies equally. Amplitude filtering can still change the waveform's shape.
An FIR filter is stable whatever its tap values.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Its impulse response is a finite list, so the sum of |h[n]| is always finite.
Window the ideal
- The ideal low-pass has an endless sinc as its impulse response. Cut it to $N$ taps by multiplying by a window $w[n]$.
- The window's own spectrum decides the result: its main lobe sets the transition width; its sidelobes set the stopband.
Match each feature of the window's spectrum to what it sets in the filter.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
The window method is a lookup. Choose the window for depth, then N for width.
The window table
- Peak sidelobes: rectangular $-13$ dB, Hann $-31$ dB, Hamming window 海明窗 $-43$ dB, Blackman $-58$ dB.
- For Hamming, the transition width is about $3.3 f_{s}/N$. These are window sidelobes, not filter stopband guarantees. Choose a starting window and $N$, then verify the filter.
A filter needs at least 50 dB of stopband attenuation. Which window works?
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Only Blackman's sidelobes sit below −50 dB. Its main lobe is wider, so it needs more taps for the same transition.
Linear phase
- Symmetric taps, $h[n] = h[N-1-n]$, give exactly linear phase 相位.
- Every frequency is delayed by the same $(N-1)/2$ samples, the group delay.

A symmetric FIR has 51 taps. What is its delay, in samples?
Difficulty 2/5 · 140 coins + a small bonus on first completion today
$(51 - 1)/2 = 25$ samples, the same for every frequency.
Worked example: size the filter
- At $f_{s} = 1$ kHz, passband edge 200 Hz and stopband edge 250 Hz give a 50 Hz transition: $N = 3.3 \times 1000/50 = 66$. Take 67, odd and symmetric.
- The delay is $(67 - 1)/2 = 33$ samples, 33 ms. With only 31 taps the transition widens to 106 Hz.
A Hamming FIR at f_s = 8 kHz needs a 400 Hz transition. Using N ≈ 3.3 f_s / Δf, how many taps is that before rounding to odd?
Difficulty 2/5 · 140 coins + a small bonus on first completion today
$3.3 \times 8000/400 = 66$, so take 67 taps for a Type I filter.
That 67-tap filter runs at 8 kHz. What is its delay, in ms? Give 3 decimal places.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
33 samples at 8 kHz is $33/8000 = 4.125$ ms.
Worked example: verify the promise
- Use a 225 Hz ideal cutoff and normalise the 67 windowed-sinc taps to unit DC gain. Compute their frequency response.
- A 0.025 Hz grid gives passband $-0.034$ to $+0.0045$ dB and stopband at most $-52.3$ dB. A result of $-37$ dB fails the $-43$ dB target; inspect the design and the measurement band.
A Hamming design measures a stopband of only −37 dB. What does that tell you?
Difficulty 1/5 · 100 coins + a small bonus on first completion today
A correct Hamming design reaches −43 dB. A shallower stopband points to a design error that only measurement reveals.
Three common slips
- Designing without measuring. Every FIR should ship with its measured response.
- An even $N$ when an odd, symmetric (Type I) filter was intended.
- Forgetting the delay. 33 ms matters inside a control loop.
Recap
- Window the ideal sinc: the window guides the stopband, $3.3 f_{s}/N$ the transition.
- Symmetric taps give linear phase with delay $(N-1)/2$.
- Measure the response against every specification.