filter
doesn't create a filter; it applies a filter to a signal:
FILTER One-dimensional digital filter.
Y = FILTER(B,A,X) filters the data in vector X with the filter described by vectors A and B to create the filtered data Y.
The filter will be low-pass, high-pass etc depending on the coefficient vectors A
, B
. These vectors contain the coefficients of the difference equation defining the filter:
a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
Equivalently, A
and B
define the numerator and denominator polynomials of the filter's transfer function, H(z).
In your case, with B = [1 1 1]
and A = 1
, it will be a low-pass FIR filter, i.e. a moving average, as you indicate in your question.
See filter
's documentation or type help filter
for details.