Signal Processing Toolbox | Help Desk |

Filter data with a recursive (IIR) or nonrecursive (FIR) filter.

y = filter(b,a,x) [y,zf] = filter(b,a,x) [...] = filter(b,a,x,zi) [...] = filter(b,a,x,zi,dim)

`filter`

is part of the MATLAB environment. It filters data using a digital filter. The filter realization is the `filter`

normalizes the filter coefficients by ```
y = filter(b,a,x)
```

filters the data in vector `x`

with the filter described by coefficient vectors `a`

and `b`

to create the filtered data vector `y`

. When `x`

is a matrix, filter operates on the columns of `x`

. When `x`

is an ```
[y,zf] = filter(b,a,x)
```

returns the final values of the states in the vector `zf`

.
```
[...] = filter(b,a,x,zi)
```

specifies initial state conditions in the vector `zi`

.
The size of the initial/final condition vector is `max(length(b),length(a))-1`

. `zi`

or `zf`

can also be an array of such vectors, one for each column of `x`

if `x`

is a matrix. If `x`

is a multidimensional array, `filter`

works across the first nonsingleton dimension of `x`

by default.
```
[...] = filter(b,a,x,zi,dim)
```

works across the dimension `dim`

of `x`

. Set `zi`

to empty to get the default initial conditions.
`filter`

works for both real and complex inputs.
Find and graph the 100-point unit impulse response of a digital filter:
x = [1 zeros(1,100)]; [b,a] = butter(12,400/1000); y = filter(b,a,x); stem(y)

`filter`

is a built-in MATLAB function. `filter`

is implemented as a transposed direct form II structurewhere

`filter`

at sample You can use

`filtic`

to generate the state vector If

`filter`

gives the following error message:
First denominator coefficient must be nonzero.If the length of the initial condition vector is not the greater of

`filter`

gives the following error message:
Initial condition vector has incorrect dimensions.