Contents Previous Next Subchapters Current Chapters-> fourier kalman_bucy filter mlmode_filter arcov fspec dpss wavelet iwavelet fnbut fncheb fnbpole fncpole fn2cbp fn2clp fc2dig fn2dbp fn2dlp Parent Chapters-> Omatrix6 filtering filter Search Tools-> contents reference index search

Auto-Regressive And Moving Average Filtering
 Syntax `filter(a, b, x, s)` See Also mlmode_filter , conv , polmul , kalman , arcov

Description
Filters the input sequence x using both the auto-regressive coefficients, a, and moving average coefficients b. If x is white noise, the return value is the ARMA process corresponding to a and b. The arguments a, b, x, and s can be either integer, real, double-precision or complex. The arguments must all be column vectors but do not have to be the same type. The return value has the type that results from coercion between the arguments types. Let `na`, `nb`, `nx` and `ns`, be the lengths of a, b, x, and s respectively. The value `ns` must satisfy the conditions `ns > na - 1`, `ns > nb - 1`, and `ns < nx`. The return vector `y` has length `nx`, and ```      if i < ns,  y  =  s                   i     i      if i > ns,  y  =  b  x  +  b  x    + . . . + b  x                   i     1  i     2  i-1            nb i-nb+1                              -  a  y    - . . . - a  y                                  2  i-1            na i-na+1 ```Note that the first element of a is not used.

Example
If you enter ```      x = {1, 2, 3}      a = {1, -1}      b = {1, 1}      s = 0      filter(a, b, x, s) ``` O-Matrix will respond ```      {      0      3      8      } ``` Note that ```      y  =  s            =  0       1     1      y  =  x  + x  + y  =  3       2     2    1    1      y  =  x  + x  + y  =  8       3     3    2    2 ```(Also note that the first element of a was not used.)