Filter Types
| Type | Passband | Stopband | Transition |
|---|
| Butterworth | Flat | Monotonic | Moderate |
| Chebyshev I | Ripple | Monotonic | Sharp |
| Chebyshev II | Flat | Ripple | Sharp |
| Elliptic | Ripple | Ripple | Sharpest |
Design Workflow
- Specify requirements: Passband, stopband, ripple, attenuation
- Choose filter type: FIR vs IIR, Butterworth vs Chebyshev, etc.
- Determine order: Trade-off between performance and computation
- Verify: Check frequency response, phase, stability
Python Example
1from scipy import signal
2import matplotlib.pyplot as plt
3
4# Design specifications
5fs = 1000 # Sampling frequency
6fp = 100 # Passband edge
7fs_edge = 150 # Stopband edge
8
9# Normalize
10wp = fp / (fs/2)
11ws = fs_edge / (fs/2)
12
13# Determine order
14order, wn = signal.buttord(wp, ws, gpass=3, gstop=40)
15b, a = signal.butter(order, wn)
16
17# Plot frequency response
18w, h = signal.freqz(b, a)
19plt.plot(w * fs/(2*np.pi), 20*np.log10(abs(h)))
20plt.xlabel('Frequency (Hz)')
21plt.ylabel('Magnitude (dB)')
22plt.grid()
23plt.show()
Related Snippets