-
sdr.bandstop_fir(order: int, center_freq: float, bandwidth: float, window: str | float | tuple | None =
'hamming'
) NDArray[float64] Designs a bandstop FIR filter impulse response
using the window method.- Parameters:¶
- order: int¶
The filter order
. Must be even.- center_freq: float¶
The center frequency
, normalized to the Nyquist frequency .- bandwidth: float¶
The two-sided bandwidth about
, normalized to the Nyquist frequency .- window: str | float | tuple | None =
'hamming'
¶ The SciPy window definition. See
scipy.signal.windows.get_window()
for details. IfNone
, no window is applied.
- Returns:¶
The filter impulse response
with length . The center of the larger passband has 0 dB gain.
References
Examples
Design a length-101 bandstop FIR filter with center frequency
and bandwidth , using a Hamming window.In [1]: h_hamming = sdr.bandstop_fir(100, 0.4, 0.75, window="hamming") In [2]: plt.figure(); \ ...: sdr.plot.impulse_response(h_hamming); ...: In [3]: plt.figure(); \ ...: sdr.plot.magnitude_response(h_hamming); ...:
Compare filter designs using different windows.
In [4]: h_hann = sdr.bandstop_fir(100, 0.4, 0.75, window="hann"); \ ...: h_blackman = sdr.bandstop_fir(100, 0.4, 0.75, window="blackman"); \ ...: h_blackman_harris = sdr.bandstop_fir(100, 0.4, 0.75, window="blackmanharris"); \ ...: h_chebyshev = sdr.bandstop_fir(100, 0.4, 0.75, window=("chebwin", 60)); \ ...: h_kaiser = sdr.bandstop_fir(100, 0.4, 0.75, window=("kaiser", 0.5)) ...: In [5]: plt.figure(); \ ...: sdr.plot.magnitude_response(h_hamming, label="Hamming"); \ ...: sdr.plot.magnitude_response(h_hann, label="Hann"); \ ...: sdr.plot.magnitude_response(h_blackman, label="Blackman"); \ ...: sdr.plot.magnitude_response(h_blackman_harris, label="Blackman-Harris"); \ ...: sdr.plot.magnitude_response(h_chebyshev, label="Chebyshev"); \ ...: sdr.plot.magnitude_response(h_kaiser, label="Kaiser"); \ ...: plt.ylim(-100, 10); ...: