FIR filter design using the window method.
This function computes the coefficients of a finite impulse response filter. The filter will have linear phase; it will be Type I if numtaps is odd and Type II if numtaps is even.
Type II filters always have zero response at the Nyquist rate, so a ValueError exception is raised if firwin is called with numtaps even and having a passband whose right end is at the Nyquist rate.
Parameters : | numtaps : int
cutoff : float or 1D array_like
width : float or None
window : string or tuple of string and parameter values
pass_zero : bool
scale : bool
nyq : float
|
---|---|
Returns : | h : 1-D ndarray
|
Raises : | ValueError :
|
See also
Examples
Low-pass from 0 to f:
>>> firwin(numtaps, f)
Use a specific window function:
>>> firwin(numtaps, f, window='nuttall')
High-pass (‘stop’ from 0 to f):
>>> firwin(numtaps, f, pass_zero=False)
Band-pass:
>>> firwin(numtaps, [f1, f2], pass_zero=False)
Band-stop:
>>> firwin(numtaps, [f1, f2])
Multi-band (passbands are [0, f1], [f2, f3] and [f4, 1]):
>>>firwin(numtaps, [f1, f2, f3, f4])
Multi-band (passbands are [f1, f2] and [f3,f4]):
>>> firwin(numtaps, [f1, f2, f3, f4], pass_zero=False)