In this section, we implement a Python FIR (Finite Impulse Response) filter design class using the window method. We use a design table based on the DSP textbook to construct this class.
We consider the following window functions:
- Rectangular
- Hanning
- Hamming
- Blackman
- Kaiser
Window | Transition | Passband | Main/Side Lobe | Stopband |
---|---|---|---|---|
Function | Width (Hz) | Ripple | Relation (dB) | Attenuation (dB) |
Rectangular | 0.9 / N | 0.7416 | 13 | 21 |
Hanning | 3.1 / N | 0.0546 | 31 | 44 |
Hamming | 3.3 / N | 0.0194 | 41 | 53 |
Blackman | 5.5 / N | 0.0017 | 57 | 74 |
Kaiser | 2.93 / N | 0.0274 | β = 4.54 | 50 |
4.32 / N | 0.00275 | β = 6.76 | 70 | |
5.71 / N | 0.000275 | β = 8.96 | 90 |
We consider the following filter types:
- Lowpass (LPF)
- Highpass (HPF)
- Bandpass (BPF)
- Bandreject (BRJF)
Type of Filter | Ideal Impulse Response | |
---|---|---|
hd[n], n ≠ 0 | hd[0] | |
Lowpass | Formula 1 | 2fc |
Highpass | Formula 2 | 1-2fc |
Bandpass | Formula 3 | 2(f2-f1) |
Bandreject | Formula 4 | 1-2(f2-f1) |
Formula 1:
Formula 2:
Formula 3:
Formula 4:
Authors: D.S. 、 Yuyu378