# butter

Create a Butterworth filter.

## Syntax

[b,a] = butter(n,Wp)

[b,a] = butter(n,Wp,band)

[b,a] = butter(n,Wp,domain)

[b,a] = butter(n,Wp,band,domain)

## Inputs

`n`- The filter order.
`Wp`- A scalar specifying the 3dB cutoff frequency of a low or high pass filter, or a two element vector specifying the cutoff 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.
`band`- The band type of the filter. Omit for low pass or bandpass. Use
'
`high`' for high pass, and '`stop`' for bandstop. `domain`- Omit for digital filters. Use '
`s`' for analog filters.

## Outputs

- b
- The numerator polynomial coefficients of the filter.
- a
- The denominator polynomial coefficients of the filter.

## Example

Create a fourth order Butterworth low pass digital filter with a 300 Hz cutoff frequency and a 1000 Hz sampling frequency.

`[b,a] = butter(4,300/500)`

```
b = [ 0.16718 0.66872 1.0031 0.66872 0.16718 ]
a = [ 1 0.7821 0.67998 0.18268 0.030119 ]
```

## Comments

The attenuation at `Wp` is 20*log10(sqrt(2)), or approximately 3.0103
dB.

Filters can become unstable for high orders, and more easily so for bandpass or stopband filters.