FIR filter design
แนะนำใหม่
7:22
การประมวลผลสัญญาณดิจิทัล
Digital signal processing rebuilds the continuous theory for samples, where arithmetic is exact: N samples in, N numbers out, and every promise can be…
บรรยายภาษาอังกฤษ · สลับคำบรรยายภาษาอังกฤษและภาษาจีนได้
ในบทเรียนนี้
| English | ความหมาย |
|---|---|
| FIR/ˌef aɪ ˈɑː/ | การตอบสนองต่อพัลส์จำกัด (FIR) |
| tap/tæp/ | One weight h[k] of an FIR filter; the list of taps is the filter's impulse response. |
| phase/feɪz/ | เฟส |
| Hamming window/ˈhæmɪŋ ˈwɪndəʊ/ | ฮัมมิ่ง |
เฟิลเตอร์ที่คุณสามารถพิสูจน์สิ่งต่างๆ เกี่ยวกับ
- ฟิลเตอร์ FIR มีความเสถียรเสมอ เนื่องจากไม่มีระบบป้อนกลับ
- 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.
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Its impulse response is a finite list, so the sum of |h[n]| is always finite.
การทำหน้าต่างฟังก์ชันที่สมบูรณ์แบบ
- ฟังก์ชัน Low-pass ที่สมบูรณ์แบบมี Impulse response เป็น Sinc แบบไม่จำกัด ต้องตัดให้เหลือ $N$ taps โดยคูณด้วยหน้าต่าง $w[n]$
- สเปกตรัมของตัวหน้าต่างเองจะกำหนดผลลัพธ์: Main lobe จะกำหนดความกว้างของการเปลี่ยนแปลง (transition width); Sidelobes จะกำหนดย่านหยุด (stopband)

An FIR filter has taps $h = [0.5,\ 0.3,\ 0.2]$. The input is $x = 2, 4, 6, \dots$ (starting at $n = 0$, zero before). Output $y[2]$?
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
$y[2] = 0.5x[2] + 0.3x[1] + 0.2x[0] = 0.5 \times 6 + 0.3 \times 4 + 0.2 \times 2 = 3 + 1.2 + 0.4 = 4.4$.
การ์ดนี้ได้รับการแก้ไขแล้ว จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะได้รับการอัปเดต
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.
- The taps themselves, centred on $M = (N-1)/2$ with cutoff $f_c$:
- Worked, for the 67-tap design below ($f_c = 225$ Hz, $f_s = 1$ kHz, $M = 33$): the centre tap is $h[33] = 0.45$. Next to it, the sinc gives $\sin(0.45\pi)/\pi = 0.3144$, and the Hamming window $0.54 - 0.46\cos(2\pi \cdot 34/66) = 0.998$ barely trims it: $h[34] = 0.3138$. Far out at the ends the window falls to 0.08, which is what quiets the sidelobes.
Match each feature of the window's spectrum to what it sets in the filter.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
The window method is a lookup. Choose the window for depth, then N for width.
A windowed-sinc low-pass has $f_c = 100$ Hz and $f_s = 1$ kHz. Its centre tap $h[M]$ (the window is 1 there)?
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
ที่ $n = M$ the sinc is 1, so $h[M] = 2f_c/f_s = 200/1000 = 0.2$. The centre tap is the fraction of the band that passes.
การ์ดนี้เป็นการ์ดใหม่ จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะพร้อม
The window table
- Each window trades a wider transition for lower sidelobes. The Hamming window 海明窗 is the usual starting point:
| Window | Peak sidelobe | Transition width |
|---|---|---|
| rectangular | −13 dB | $0.9 f_s/N$ |
| Hann | −31 dB | $3.1 f_s/N$ |
| Hamming | −43 dB | $3.3 f_s/N$ |
| Blackman | −58 dB | $5.5 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 is the safe starting choice?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Only Blackman's window sidelobes sit below −50 dB, so it meets the target by design; it needs more taps for the same transition. A Hamming filter can measure better than −43 dB (the check below finds −52.3 dB), but that is luck you verify, not a promise.
เฟสเชิงเส้น (Linear phase)
- Taps แบบสมมาตร, $h[n] = h[N-1-n]$, ให้ เฟส เป็นเชิงเส้นอย่างสมบูรณ์
- ทุกความถี่ถูกหน่วงเวลาด้วย $(N-1)/2$ สัมประสิทธิ์เท่ากัน นั่นคือความล่าช้าของกลุ่ม


A symmetric FIR has 51 taps. What is its delay, in samples?
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
$(51 - 1)/2 = 25$ samples, the same for every frequency.
ตัวอย่างการคำนวณ: กำหนดขนาดฟิลเตอร์
- 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.
- Group delay คือ $(67 - 1)/2 = 33$ samples, เท่ากับ 33 ms. หากใช้เพียง 31 taps ความกว้างของการเปลี่ยนแปลงจะขยายเป็น 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?
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
$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.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
33 samples at 8 kHz is $33/8000 = 4.125$ ms.
ตัวอย่างการคำนวณ: ตรวจสอบผลที่ได้
- 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 specified to reach −43 dB over its stopband measures only −37 dB there. What does that tell you?
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
A correct Hamming windowed-sinc design reaches about −43 dB or better (the 67-tap design measures −52 dB). A shallower stopband points to an error in the design or in the measured band, and only measurement reveals it.
การ์ดนี้ได้รับการแก้ไขแล้ว จึงแสดงเป็นภาษาอังกฤษจนกว่าคำแปลจะได้รับการอัปเดต
Four 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.
- Expecting a moving average to have a strong stopband. It is a low-pass filter, but the three-point average has a response that rises back to $\tfrac13$ at Nyquist.
สรุปทบทวน
- ใช้หน้าต่างซิงค์ที่สมบูรณ์แบบ: หน้าต่างนำทางย่านหยุด, $3.3 f_{s}/N$สำหรับการเปลี่ยนแปลง
- ทาปแบบสมมาตรให้เฟสเป็นเชิงเส้นพร้อมความหน่วง $(N-1)/2$
- วัดการตอบสนองตามข้อกำหนดทุกข้อ
เกิดปัญหาอะไรขึ้น? เฉพาะทีมเว็บไซต์เท่านั้นที่เห็นข้อมูลนี้