Signal Processing Toolbox |
Butterworth analog and digital filter design
Syntax
[b,a]=
butter(n,Wn) [b,a]=
butter(n,Wn,'ftype
') [b,a]=
butter(n,Wn,'s
') [b,a]=
butter(n,Wn,'ftype
','s
') [z,p,k]=
butter(...) [A,B,C,D]=
butter(...)
Description
butter
designs lowpass, bandpass, highpass, and bandstop digital and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that is maximally flat in the passband and monotonic overall.
Butterworth filters sacrifice rolloff steepness for monotonicity in the pass- and stopbands. Unless the smoothness of the Butterworth filter is needed, an elliptic or Chebyshev filter can generally provide steeper rolloff characteristics with a lower filter order.
Digital Domain
[b,a] = butter(n,Wn)
designs an order n
lowpass digital Butterworth filter with normalized cutoff frequency Wn
. It returns the filter coefficients in length n+1
row vectors b
and a
, with coefficients in descending powers of z.
Cutoff frequency is that frequency where the magnitude response of the filter is . For
butter
, the normalized cutoff frequency Wn
must be a number between 0 and 1, where 1 corresponds to the Nyquist frequency, radians per sample.
If Wn
is a two-element vector, Wn
= [w1 w2]
, butter
returns an order 2*n
digital bandpass filter with passband w1
<
<
w2
.
[b,a] = butter(n,Wn,'
designs a highpass, lowpass, or bandstop filter, where the string ftype
')
'
ftype
'
is one of the following.
'high'
for a highpass digital filter with normalized cutoff frequency Wn
'low'
for a lowpass digital filter with normalized cutoff frequency Wn
'stop'
for an order 2*n
bandstop digital filter if Wn
is a two-element vector, Wn
= [w1 w2]
. The stopband is w1
< < w2
.
With different numbers of output arguments, butter
directly obtains other realizations of the filter. To obtain zero-pole-gain form, use three output arguments as shown below:
returns the zeros and poles in length [z,p,k] = butter(n,Wn,
'ftype
')
n
column vectors z
and p
, and the gain in the scalar k
.
To obtain state-space form, use four output arguments as shown below:
where [A,B,C,D] = butter(n,Wn,'
ftype
')
A
, B
, C
, and D
are
and u is the input, x is the state vector, and y is the output.
Analog Domain
[b,a] = butter(n,Wn,'
designs an order s
')
n
lowpass analog Butterworth filter with angular cutoff frequency Wn
rad/s. It returns the filter coefficients in the length n+1
row vectors b
and a
, in descending powers of s, derived from this transfer function:
butter
's angular cutoff frequency Wn
must be greater than 0 rad/s.
If Wn
is a two-element vector with w1
< w2
, butter(n,Wn,
's
')
returns an order 2*n
bandpass analog filter with passband w1
< < w2
.
[b,a] = butter(n,Wn,'
designs a highpass, lowpass, or bandstop filter. ftype
','s
')
With different numbers of output arguments, butter
directly obtains other realizations of the analog filter. To obtain zero-pole-gain form, use three output arguments as shown below:
returns the zeros and poles in length [z,p,k] = butter(n,Wn,'
ftype
','
s
')
n
or 2*n
column vectors z
and p
and the gain in the scalar k
.
To obtain state-space form, use four output arguments as shown below:
[A,B,C,D] = butter(n,Wn,'
ors
')
where [A,B,C,D] = butter(n,Wn,'
ftype
','
s
')
A
, B
, C
, and D
are
and u is the input, x is the state vector, and y is the output.
Example 1
For data sampled at 1000 Hz, design a 9th-order highpass Butterworth filter with cutoff frequency of 300 Hz, which corresponds to a normalized value of 0.6:
The filter's frequency response is
Example 2
Design a 10th-order bandpass Butterworth filter with a passband from 100 to 200 Hz and plot its impulse response, or unit sample response:
Limitations
For high order filters, the state-space form is the most numerically accurate, followed by the zero-pole-gain form. The transfer function coefficient form is the least accurate; numerical problems can arise for filter orders as low as 15.
Algorithm
butter
uses a five-step algorithm:
buttap
function.
butter
uses bilinear
to convert the analog filter into a digital filter through a bilinear transformation with frequency prewarping. Careful frequency adjustment guarantees that the analog filters and the digital filters will have the same frequency response magnitude at Wn
or w1
and w2
.
See Also
besself
, buttap
, buttord
, cheby1
, cheby2
, ellip
, maxflat
buttap | buttord |
© 1994-2005 The MathWorks, Inc.