buttord
Builtin index · Signal processing
result = buttord(wp, ws, rp, rs, fs)
Input: wp, ws, rp, rs, fs · Output: result
What it is
wp, ws: the passband and stopband edges in Hz, each one number (lowpass when wp < ws, highpass when wp > ws) or each a [low, high] vector (bandpass when the stopband edges lie outside the passband, bandstop when they lie inside); rp: number, the most the passband may lose (dB); rs: number, the least the stopband must lose (dB); fs: number (Hz, also accepted as fs=).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = buttord(wp, ws, rp, rs, fs) | wp number or vectorwp, ws: the passband and stopband edges in Hz, each one number (lowpass when wp < ws, highpass when wp > ws) or each a [low, high] vector (bandpass when the stopband edges lie outside the passband, bandstop when they lie inside).ws number or vectorwp, ws: the passband and stopband edges in Hz, each one number (lowpass when wp < ws, highpass when wp > ws) or each a [low, high] vector (bandpass when the stopband edges lie outside the passband, bandstop when they lie inside).rp numberrp: number, the most the passband may lose (dB).rs numberrs: number, the least the stopband must lose (dB).fs numberfs: number (Hz, also accepted as fs=). | result number or string | Returns a record {order, wn, kind}: the lowest Butterworth order meeting the specification, the -3 dB frequency to design it with (Hz; a number, or [low, high]) and the band shape as the string butter takes, so the design is butter(r.order, r.kind, r.wn, fs). wn is chosen so the passband edge loses exactly rp dB; the stopband then has margin. Uses the analog-prototype order formula log10((10^(rs/10)-1)/(10^(rp/10)-1)) / (2 log10(k)) on the prewarped edges (tan(pi f / fs)), k being the stopband-to-passband edge ratio of the lowpass prototype (MATLAB/SciPy buttord; SciPy's choice of wn). For a bandstop the passband edges are first moved into the transition bands as far as lowers the order, as SciPy does. Note that a "band"/"stop" design of order n has 2n poles. |
Examples
No documentation example calls this form yet. The Signal processing chapter is where one belongs.
How it works
buttord(wp, ws, rp, rs, fs) / cheb1ord / cheb2ord / ellipord -- the lowest order of that family meeting a passband/stopband specification, and the frequency to design it with: a record {order, wn, kind} for butter(r.order, r.kind, r.wn, fs) and its siblings. The band shape is read from the edges (one each: low/high by which is lower; two each: band/stop by which pair is inside).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.