ts1 = filter(ts, numerator, denominator)
ts1=filter(ts, numerator, denominator, index)
applies the transfer function filter b(z^{−1})/a(z^{−1}) to
the data in the ts1
= filter(ts
, numerator
, denominator
) timeseries
object ts
. b
and a
are
the coefficient arrays of the transfer function numerator and denominator,
respectively.
uses the optional ts1
=filter(ts
, numerator
, denominator
, index
) index
integer array to specify
either the columns or rows to filter, depending on the value of ts.IsTimeFirst
.

The first 

The coefficient array of the transfer function numerator. 

The coefficient array of the transfer function denominator. 

An integer array that specifies the columns or rows to filter
when 

The 
The timeseries data must be uniformly sampled to use this filter.
The following function
y = filter(b,a,x)
creates filtered data y
by processing the
data in vector x
with the filter described by vectors a
and b
.
The filter
function is a general
tapped delayline filter, described by the difference equation:
a(1)y(n) = b(1)x(n) + b(2)x(n − 1) + ... + b(nb)x(n − nb + 1) − a (2)y(n − 1) − ... − a(N_{a})y(n − N_{b} + 1).
Here, n is the index of the current sample, N_{a} is
the order of the polynomial described by vector a
,
and N_{b} is the order of the
polynomial described by vector b
. The output y(n)
is a linear combination of current and previous inputs, x(n) x(n −1)...,
and previous outputs, y(n −
1) y(n − 2)... .
You use the discrete filter to shape the data by applying a transfer function to the input signal.
Depending on your objectives, the transfer function you choose might alter both the amplitude and the phase of the variations in the data at different frequencies to produce either a smoother or a rougher output.
In digital signal processing (DSP), it is customary to write transfer functions as rational expressions in z^{−1} and to order the numerator and denominator terms in ascending powers of z^{−1}.
Taking the ztransform of the difference equation
a(1)y(n) = b(1)x(n) + b(2)x(n −1) + ... + b(nb)x(n − nb + 1) − a (2)y(n − 1) − ... − a(na)y(na + 1),
results in the transfer function
$$Y(z)=H({z}^{1})X(z)=\frac{b(1)+b(2){z}^{1}+\mathrm{...}+b(nb){z}^{nb+1}}{a\left(1\right)+a(2){z}^{1}+\mathrm{...}+a(na){z}^{na+1}}X(z),$$
where Y(z) is the ztransform of the filtered output y(n). The coefficients b and a are unchanged by the ztransform.