: y = filter (b, a, x)
: [y, sf] = filter (b, a, x, si)
: [y, sf] = filter (b, a, x, [], dim)
: [y, sf] = filter (b, a, x, si, dim)

Apply a 1-D digital filter to the data x.

filter returns the solution to the following linear, time-invariant difference equation:

N                   M
SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)    for 1<=n<=length(x)
k=0                 k=0

where N=length(a)-1 and M=length(b)-1. The result is calculated over the first non-singleton dimension of x or over dim if supplied.

An equivalent form of the equation is:

         N                   M
y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1<=n<=length(x)
        k=1                 k=0

where c = a/a(1) and d = b/a(1).

If the fourth argument si is provided, it is taken as the initial state of the system and the final state is returned as sf. The state vector is a column vector whose length is equal to the length of the longest coefficient vector minus one. If si is not supplied, the initial state vector is set to all zeros.

In terms of the Z Transform, y is the result of passing the discrete-time signal x through a system characterized by the following rational system function:

         M
        SUM d(k+1) z^(-k)
        k=0
H(z) = ---------------------
           N
      1 + SUM c(k+1) z^(-k)
          k=1

See also: filter2, fftfilt, freqz.

Package: communications