LINAVG

Purpose:

Calculates a moving average with zero phase shift.

Syntax:

LINAVG(series, N, rampflag)

series

-

Any series, table, or expression resulting in a series or table.

N

-

An integer, the number of points to average as the series is processed.

rampflag

-

Optional. An integer, endpoint averaging flag.

0:

down

1:

up (default)

Returns:

A series or table.

Example:

W1: 1..5

W2: linavg(w1, 3)

 

W2 contains the series:

 

{1.5, 2.167, 3.0, 3.833, 4.5}

 

The X offset of the result is 1.0.

Example:

W1: integ(gnorm(1000, 1/100))

W2: movavg(w1, 40)

W3: linavg(w1, 20)

W4: w1;overp(w2);overp(w3)

 

W1 contains 1000 samples of synthesized data.

W2 performs a 10 point standard moving average.

W3 performs a zero phase moving average by reversing the original data, computing a 10 point moving average, reversing the result and computing another 10 point moving average.

W4 contains the original data with overplots of the standard moving average in red and zero phase moving average in gold. Compared to the standard moving average, the peaks of the zero phase series line up with the original data.

Remarks:

LINAVG computes a zero phase moving average by reversing the input series, computing an N point moving average, reversing the result and computing another N point moving average. The reversal steps help ensure that the peak locations of the original data are preserved. The data is effectively smoothed with an 2N point average.

 

See LINEXPAVG to compute a zero phase exponential moving average.

 

See MOVMEAN for a centered moving average that also preserves peak locations.

See Also:

AVGFILT

LINEXPAVG

LINMEDIAN

LINRMS

MOVAVG

MOVAVG2

MOVMAX

MOVMEAN

MOVMIN

SGOLAYFILT