expave(var, ff [, mode])

This is a simple single pole filter, defined as
res[t] = (1 - ff[t]) * res[t-1] + ff[t] * var[t]
such that var is the initial (input) column, res is the resulting (output) column, t is the current row number, ff is the filter factor, and mode is used to control processing of errors. The valid range of ff is
0. <= ff <= 1.
This transform is equivalent to this general filter implemented with:
$arx: $arx(var, 0, ff, -(1-ff), mode)
except that $arx does not place restrictions on the values of ff and has slightly different error-handling modes.
Relationship to correlation: There are two common representations of a first order filter. The filter factor (ff) representation as defined above is commonly used by Chemical Engineers. Users with a signal processing or statistics background are typically more comfortable with specifying c, which is called the correlation coefficient, the discrete pole, or the smoothing factor. ff is equivalent to 1-c.
Relationship to time constant: It is often convenient to filter based on a time constant. If you want to specify the filter factor in terms of a time constant, use this formula: ff=1-exp(-dt/tau) such that dt is the sampling frequency of the system, and tau is the time constant of the filter.
The mode argument is used to control processing of Error statuses; it is any one of FILTER_DISABLE, FILTER_SMOOTH, or FILTER_FREEZE. FILTER_DISABLE causes the filter to go off-line and propagate the Error status to the output. This is the typical mode used during signal shaping and noise filtering applications where errors are not a systematic part of the process. FILTER_SMOOTH is more applicable when frequent errors are expected as part of normal behavior, such as when a set of sparse lab measurements occurs with intervening error values. In this mode, the filter returns an OK status and attempts to filter smoothly over the error condition. FILTER_FREEZE clamps the last good value of res[t] during an input Error condition but does not propagate the Error status to the output; when a new valid input is available, the filter output is reset to this new value.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.