Signal Toolkit - buttord
- Function File:
n =
buttord(wp, ws, rp, rs)
- Function File:
n =
buttord([wp1, wp2], [ws1, ws2], rp, rs)
- Function File:
n =
buttord([wp1, wp2], [ws1, ws2], rp, rs, "s")
- Function File:
[n, wc_p] =
buttord(…)
- Function File:
[n, wc_p, wc_s] =
buttord(…)
Compute the minimum filter order of a Butterworth filter with the desired response characteristics. The filter frequency band edges are specified by the passband frequency wp and stopband frequency ws. Frequencies are normalized to the Nyquist frequency in the range [0,1]. rp is the allowable passband ripple measured in decibels, and rs is the minimum attenuation in the stop band, also in decibels.
The output arguments n and wc_p (or n and wc_n) can be given as inputs to
butter
. Using wc_p makes the filter characteristic touch at least one pass band corner and using wc_s makes the characteristic touch at least one stop band corner.If wp and ws are scalars, then wp is the passband cutoff frequency and ws is the stopband edge frequency. If ws is greater than wp, the filter is a low-pass filter. If wp is greater than ws, the filter is a high-pass filter.
If wp and ws are vectors of length 2, then wp defines the passband interval and ws defines the stopband interval. If wp is contained within ws (ws1 < wp1 < wp2 < ws2), the filter is a band-pass filter. If ws is contained within wp (wp1 < ws1 < ws2 < wp2), the filter is a band-stop or band-reject filter.
If the optional argument
"s"
is given, the minimum order for an analog elliptic filter is computed. All frequencies wp and ws are specified in radians per second.Theory: For Low pass filters, |H(W)|^2 = 1/[1+(W/Wc)^(2N)] = 10^(-R/10). With some algebra, you can solve simultaneously for Wc and N given Ws,Rs and Wp,Rp. Rounding N to the next greater integer, one can recalculate the allowable range for Wc (filter caracteristic touching the pass band edge or the stop band edge).
For other types of filter, before making the above calculation, the requirements must be transformed to LP requirements. After calculation, Wc must be transformed back to original filter type.
See also: butter, cheb1ord, cheb2ord, ellipord.