Moving Average

Syntax
Hd = movaver(Order,DFormat)

Description
Moving average FIR filter design. The moving average (MA) filter is probably one of the most widely used FIR filters due to its conceptual simplicity and ease of implementation. However, despite its simplicity, the moving average filter is optimal for reducing random noise while retaining a sharp step response. Where a simple rule of thumb states that the amount of noise reduction is equal to the square-root of the number of points in the average. For example, an MA of length 9 will result in a factor 3 noise reduction.

Order: may be specified up to 499 (professional) and up to 128 (educational) edition.

DFormat: allows you to specify the display format of resulting digital filter object.

symbolic Display a symbolic representation of the filter object. If the order > 10, the symbolic display option will be overridden and set to numeric.
numeric Display a matrix representation of the filter object
void Create a filter object, but do not display output

Example
[code lang=”java”]ClearH1; // clear primary filter from cascade

Main()

Hd=movaver(8,”symbolic”);

Num = getnum(Hd); // define numerator coefficients
Den = {1}; // define denominator coefficients
Gain = getgain(Hd); // define gain

[/code]
Further Reading

A more detailed disucussion about the moving average filter and an improvement via the Kolmogorov–Zurbenko (KZ) filter can be found in the blog.

See also:

Kolmogorov–Zurbenko (KZ) filtering  / firwin / firarb / firkaiserfirgaussfirlp2notchsavgolay