kaiserord
Builtin index · Signal processing
result = kaiserord(freqs, amps, dev, [fs=2])
Input: freqs, amps, dev, fs · Output: result
What it is
freqs: the transition-band edges, two per transition, increasing ([pass_end, stop_start] for a lowpass; four values for a bandpass or bandstop), in Hz when fs is given, otherwise normalized with 1 = Nyquist; amps: one amplitude per band (2 or 3 bands; [1, 0] lowpass, [0, 1] highpass, [0, 1, 0] bandpass, [1, 0, 1] bandstop); dev: the allowed deviation, one number or one per band (0.01 is 1 % passband ripple or 40 dB of stopband attenuation); fs (optional number, positional or fs=).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = kaiserord(freqs, amps, dev, [fs=2]) | freqs —freqs: the transition-band edges, two per transition, increasing ([pass_end, stop_start] for a lowpass.amps —amps: one amplitude per band (2 or 3 bands.dev numberdev: the allowed deviation, one number or one per band (0.01 is 1 % passband ripple or 40 dB of stopband attenuation).fs number, optional (default 2)fs (optional number, positional or fs=). | result — | Returns Kaiser's estimate of the FIR order and window beta for a ripple specification, as a record {order, beta, wn, kind} for fir1(r.order, r.wn, kind=r.kind, window="kaiser", beta=r.beta, fs=fs). Kaiser's formulas: with A = -20 log10(min dev) and dw the narrowest transition in rad/sample, order = ceil((A - 7.95) / (2.285 dw)) and beta = 0.1102 (A - 8.7) above 50 dB, 0.5842 (A - 21)^0.4 + 0.07886 (A - 21) from 21 to 50 dB, 0 below. wn is the middle of each transition. The order is made even when the last band is a passband. It is an estimate: a lowpass or highpass designed from it normally meets dev; in a bandpass or bandstop the ripples of the two transitions add, so the passband can exceed dev by up to a factor of two (ask for half the deviation). |
Examples
No documentation example calls this form yet. The Signal processing chapter is where one belongs.
How it works
kaiserord(freqs, amps, dev, [fs=2]) -- Kaiser's estimate of the FIR order and window beta for a deviation specification: a record {order, beta, wn, kind} for fir1(r.order, r.wn, kind=r.kind, window="kaiser", beta=r.beta, fs=fs).
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.