Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

1-D digital filter

`y = filter(b,a,x)`

`y = filter(b,a,x,zi)`

`y = filter(b,a,x,zi,dim)`

```
[y,zf] =
filter(___)
```

filters
the input data `y`

= filter(`b`

,`a`

,`x`

)`x`

using a rational transfer function defined
by the numerator and denominator coefficients `b`

and `a`

.

If `a(1)`

is not equal to `1`

,
then `filter`

normalizes the filter coefficients
by `a(1)`

. Therefore, `a(1)`

must
be nonzero.

If

`x`

is a vector, then`filter`

returns the filtered data as a vector of the same size as`x`

.If

`x`

is a matrix, then`filter`

acts along the first dimension and returns the filtered data for each column.If

`x`

is a multidimensional array, then`filter`

acts along the first array dimension whose size does not equal 1.

If you have Signal Processing Toolbox™, use

`y = filter(d,x)`

to filter an input signal`x`

with a`digitalFilter`

object`d`

. To generate`d`

based on frequency-response specifications, use`designfilt`

.To use the

`filter`

function with the`b`

coefficients from an FIR filter, use`y = filter(b,1,x)`

.See Digital Filtering (Signal Processing Toolbox) for more on filtering functions.

[1] Oppenheim, Alan V., Ronald W. Schafer,
and John R. Buck. *Discrete-Time Signal Processing*.
Upper Saddle River, NJ: Prentice-Hall, 1999.