Linear discrete filter.
[y,z]=filter(b,a,x, zi)
a The vector for auto-regressive part of the filter.
b The vector of moving average part of the filter.
x The vector of input.
zi A vector of size max(na, nb) to specify the 'initial conditions', typically the second output from a previous call to the function.
y The vector of outputs.
z The terminal state of the discrete dynamical system used to implement the filter.

Solves the discrete dynamic system
The ordinary differential equation dy/dx+y=1 can be discretized as (1+h)y[i]-y[i-1]=h for a step size of h . The function filter may used to solve this problem as follows:
>>a=[1.01 -1]