buttord

Design a Butterworth filter.

Syntax

[n,Wn] = buttord(Wp,Ws,Rp,Rs,domain)

Inputs

Wp
A scalar specifying the passband frequency of a low or high pass filter, or a two element vector specifying the passband frequencies of a bandpass or bandstop filter. For a digital filter the values (in Hz) are normalized relative to the Nyquist frequency. For an analog filter the values are in radians/sec.
Ws
A scalar specifying the stopband frequency of a low or high pass filter, or a two element vector specifying the stopband frequencies of a bandpass or bandstop filter. For a digital filter the values (in Hz) are normalized relative to the Nyquist frequency. For an analog filter the values are in radians/sec.
Rp
The maximum attenuation in decibels at Wp.
Rs
The minimum attenuation in decibels at Ws.
domain
Omit for digital filters. Use 's' for analog filters.

Outputs

n
The lowest filter order that will meet the requirements.
Wn
Normalized frequency input for which the requirement is met.

Example

Design a digital Butterworth filter with no more than 1 dB attenuation at 100 Hz and at least 20 dB attenuation at 200 Hz, with a 1000 Hz sampling frequency.

[n,Wn] = buttord(100/500, 200/500, 1, 20)
  n = 4
Wn = 0.2338

Comments

In general, there are a range of corner frequencies for which the requirements can be met at the lowest order. If Rp ~= 3.0103 (the half-power point) then Wp is the smallest passband meeting the design requirement. Wn is the largest passband meeting the design requirement.