Documentation Center

  • Trial Software
  • Product Updates

buttord

Butterworth filter order and cutoff frequency

Syntax

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

Description

buttord calculates the minimum order of a digital or analog Butterworth filter required to meet a set of filter design specifications.

Digital Domain

[n,Wn] = buttord(Wp,Ws,Rp,Rs) returns the lowest order, n, of the digital Butterworth filter with no more than Rp dB of passband ripple and at least Rs dB of attenuation in the stopband. The scalar (or vector) of corresponding cutoff frequencies, Wn, is also returned. Use the output arguments n and Wn in butter.

Choose the input arguments to specify the stopband and passband according to the following table.

Description of Stopband and Passband Filter Parameters

ParameterDescription

Wp

Passband corner frequency Wp, the cutoff frequency, is a scalar or a two-element vector with values between 0 and 1, with 1 corresponding to the normalized Nyquist frequency, π radians per sample.

Ws

Stopband corner frequency Ws, is a scalar or a two-element vector with values between 0 and 1, with 1 corresponding to the normalized Nyquist frequency.

Rp

Passband ripple in decibels.

Rs

Stopband attenuation in decibels. This value is the number of decibels the stopband is down from the passband.

Use the following guide to specify filters of different types.

Filter Type Stopband and Passband Specifications

Filter Type

Stopband and Passband Conditions

Stopband

Passband

Lowpass

Wp < Ws, both scalars

(Ws,1)

(0,Wp)

Highpass

Wp > Ws, both scalars

(0,Ws)

(Wp,1)

Bandpass

The interval specified by Ws contains the one specified by Wp (Ws(1) < Wp(1) < Wp(2) < Ws(2)).

(0,Ws(1)) and (Ws(2),1)

(Wp(1),Wp(2))

Bandstop

The interval specified by Wp contains the one specified by Ws (Wp(1) < Ws(1) < Ws(2) < Wp(2)).

(Ws(1),Ws(2))

(0,Wp(1)) and (Wp(2),1)

If your filter specifications call for a bandpass or bandstop filter with unequal ripple in each of the passbands or stopbands, design separate lowpass and highpass filters according to the specifications in this table, and cascade the two filters together.

Analog Domain

[n,Wn] = buttord(Wp,Ws,Rp,Rs,'s') finds the minimum order n and cutoff frequencies Wn for an analog Butterworth filter. You specify the frequencies Wp and Ws similar those described in the Description of Stopband and Passband Filter Parameters table above, only in this case you specify the frequency in radians per second, and the passband or the stopband can be infinite.

Use buttord for lowpass, highpass, bandpass, and bandstop filters as described in the Filter Type Stopband and Passband Specifications table above.

Examples

expand all

Lowpass Butterworth Filter

For data sampled at 1000 Hz, design a lowpass filter with no more than 3 dB of ripple in a passband from 0 to 40 Hz, and at least 60 dB of attenuation in the stopband. Find the filter order and cutoff frequency.

Wp = 40/500; Ws = 150/500;
[n,Wn] = buttord(Wp,Ws,3,60)
n =

     5


Wn =

    0.0810

Specify the filter in terms of second-order sections and plot the frequency response.

[z,p,k] = butter(n,Wn);
sos = zp2sos(z,p,k);
freqz(sos,512,1000);
title(sprintf('n = %d Butterworth Lowpass Filter',n))

Bandpass Butterworth Filter

Design a bandpass filter with a passband from 60 to 200 Hz with at most 3 dB of passband ripple and at least 40 dB attenuation in the stopbands. Specify a sampling rate of 1 kHz. Have the stopbands be 50 Hz wide on both sides of the passband. Find the filter order and cutoff frequencies.

Wp = [60 200]/500; Ws = [50 250]/500;
Rp = 3; Rs = 40;
[n,Wn] = buttord(Wp,Ws,Rp,Rs)
n =

    16


Wn =

    0.1198    0.4005

Specify the filter in terms of second-order sections and plot the frequency response.

[z,p,k] = butter(n,Wn);
sos = zp2sos(z,p,k);
freqz(sos,128,1000)
title(sprintf('n = %d Butterworth Bandpass Filter',n))

More About

expand all

Algorithms

buttord's order prediction formula is described in [1]. It operates in the analog domain for both analog and digital cases. For the digital case, it converts the frequency parameters to the s-domain before estimating the order and natural frequency, and then converts back to the z-domain.

buttord initially develops a lowpass filter prototype by transforming the passband frequencies of the desired filter to 1 rad/s (for lowpass and highpass filters) and to –1 and 1 rad/s (for bandpass and bandstop filters). It then computes the minimum order required for a lowpass filter to meet the stopband specification.

References

[1] Rabiner, L. R., and B. Gold. Theory and Application of Digital Signal Processing. Englewood Cliffs, NJ: Prentice-Hall, 1975, p. 227.

See Also

| | | |

Was this topic helpful?