remez
Builtin index · Signal processing
result = remez(order, bands, desired, [weights], [fs=2])
Input: order, bands, desired, weights, fs · Output: result
What it is
order: number (taps = order+1); bands: band-edge pairs, increasing ([0, 0.3, 0.4, 1] is two bands with a transition between them), in Hz when fs is given, otherwise normalized with 1 = Nyquist; desired: the amplitude at each band edge (same length as bands; linear across a band); weights (optional vector, positional or weights=): one positive weight per band, default all 1 (a band with weight 10 gets a tenth of the ripple); fs (optional number, positional or fs=).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = remez(order, bands, desired, [weights], [fs=2]) | order numberorder: number (taps = order+1).bands —bands: band-edge pairs, increasing ([0, 0.3, 0.4, 1] is two bands with a transition between them), in Hz when fs is given, otherwise normalized with 1 = Nyquist.desired —desired: the amplitude at each band edge (same length as bands.weights vector, optionalweights (optional vector, positional or weights=): one positive weight per band, default all 1 (a band with weight 10 gets a tenth of the ripple).fs number, optional (default 2)fs (optional number, positional or fs=). | Model —kind "filter", field b | Returns the Parks-McClellan equiripple linear-phase FIR filter as a Model (kind "filter", field b), like fir1. Designed by the Remez exchange algorithm (MATLAB firpm, SciPy remez): the linear-phase FIR with the smallest possible largest weighted error over the bands, which makes the ripple equal everywhere in a band. An even order gives a Type I filter; an odd order a Type II filter, which is zero at Nyquist, so a highpass or bandstop needs an even order (an error says so). Antisymmetric designs (Hilbert transformers, differentiators) are not built: type="hilbert" and type="differentiator" are errors. It uses the whole transition band it is given, which a window design cannot: at order 40 with edges 0.3 and 0.4 and a stopband weight of 10 the stopband is 50.5 dB down from 0.4 on, where a Hamming fir1 of the same order with its cutoff at 0.35 has only reached 22 dB at 0.4. |
Examples
No documentation example calls this form yet. The Signal processing chapter is where one belongs.
How it works
remez(order, bands, desired, [weights], [fs=2]) (alias firpm) -- Parks-McClellan equiripple linear-phase FIR design. bands are band-edge pairs, desired the amplitude at each edge, weights one per band. Same "filter" model (field b) as fir1/firls.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.