Moving averages, summation
|SYNTAX||IIR( input, b0 = 1, a1 = 0, b1 = 0, a2 = 0, b2 = 0, a3 = 0, b3 = 0, a4 = 0, b4 = 0 )|
|FUNCTION|| The function implements fast 4th-order infinite impulse response filter.
Analytically it is:
y[ n ] = b0 * x[ n ] + b1 * x[ n - 1 ] + b2 * x[ n - 2 ] + b3 * x[ n - 3 ] + b4 * x[ n - 4 ] + a1 * y[ n - 1 ] + a2 * y[ n - 2 ] + a3 * y[ n - 4 ] + a4 * y[ n -4 ];
Filters of orders 3 and 2 can be implemented by leaving unneeded arguments at default value of zero.
Coefficients b0, b1, b2, b3, b4 multiply the input signal x[n] and are referred to as the feedforward coefficients. Coefficients a1, a2, a3, a4 multiply the output signal y[n] and are referred to as the feedback coefficients. Pay careful attention to the sign of the feedback coefficients. Some design tools flip the sign of the feedback coefficients. In this case the feedback coefficients must be negated.
This convention is used so feedback coefficients work the same as in AMA2 in case of first order filter, so
IIR( array, factor, 1-factor )
is the same as
AMA2( array, factor, 1-factor )
(with very minor difference is that IIR uses internally double precision arithmetic while AMA2 uses single precision)
|SEE ALSO||AMA() function , AMA2() function|
The IIR function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.