MOVAVG

Purpose:

"Smooths" a series or table by averaging around each point.

Syntax:

MOVAVG(series, N, rampflag)

series

-

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:

movavg({4, 3, 2, 1, 2, 3, 4}, 3)

 

returns the series {4.0, 3.5, 3, 2, 1.67, 2, 3, 3.5, 4}.

Example:

movavg({4, 3, 2, 1, 2, 3, 4}, 3, 0)

 

returns the series {1.33, 2.33, 3.0, 2.0, 1.67, 2, 3, 2.33}

Remarks:

In particular, for series x of length N, movavg(x, 3) returns the following N+2 length series:

 

image\movavg01.gif

 

 

If rampflag is 0, movavg(x, 3, 0) returns the following N+2 length series:

 

image\movavg02.gif

 

MOVAVG operates on Real and Complex series. The output series is longer than original one by the number of points averaged minus 1. This causes a phase shift in the screen display.

 

MOVAVG pads the series with zeros at the beginning and end before computing the average. MOVAVG2 does not pad in such a way.

 

See LINAVG to compute a moving average with zero phase shift.

 

See EXPMOVAVG to compute the exponential moving average.

 

See BLOCKAVG to compute a non-overlapping moving average.

See Also:

AVGFILT

BLOCKAVG

CUMAVG

EXPMOVAVG

LINAVG

MOVAVG2

MOVMAX

MOVMEDIAN

MOVMIN

SGOLAYFILT