.if n .ds Q \&"
.if t .ds Q ``
.if n .ds U \&"
.if t .ds U ''
.TH rmean 3m "CODAS Utilities" "GFI"
.tr \&
.nr bi 0
.nr ll 0
.nr el 0
.de DS
..
.de DE
..
.de Pp
.ie \\n(ll>0 \{\
.ie \\n(bi=1 \{\
.nr bi 0
.if \\n(t\\n(ll=0 \{.IP \\(bu\}
.if \\n(t\\n(ll=1 \{.IP \\n+(e\\n(el.\}
.\}
.el .sp
.\}
.el \{\
.ie \\nh=1 \{\
.LP
.nr h 0
.\}
.el .PP
.\}
..
.SH NAME

.Pp
\fBrmean\fP - Calculate running mean values from a vector

.SH SYNOPSIS

.Pp
[\fIb\fP, \fIgood\fP] = \fBrmean
\fIa\fP\fP(\fIn\fP
)

.SH DESCRIPTION

.Pp
Calculates the mean value for each set of \fIn\fP consecutive elements in
\fIa\fP ,
moving along the elements of \fIa\fP. Vector a may have \fBNaN\fP
values. Calling with
\fIn\fP less than one, the function will return the input array with
\fBNaN\fP values removed and the mask to
these values.
.SH PARAMETERS

.Pp
.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBa \fP  "
.nr bi 1
.Pp
Vector of length N.
.Pp
.IP "\fBn\fP  "
.nr bi 1
.Pp
Number of subsequent elements to take into account for calculating mean
values.
.Pp
.if \n(ll>1 .RE
.nr ll -1
.SH RETURNS

.Pp
.nr ll +1
.nr t\n(ll 2
.if \n(ll>1 .RS
.IP "\fBb\fP  "
.nr bi 1
.Pp
Vector of length \f(CR(N-2)\fP. Element \f(CRb(i)\fP is the mean value of
the elements of
\fIa\fP,starting from \f(CRa(i)\fP.
.Pp
.IP "\fBgood \fIoptional\fP\fP  "
.nr bi 1
.Pp
Indexes to the elements of a that were used.
.Pp
.if \n(ll>1 .RE
.nr ll -1
.SH AUTHORS

.Pp
Pierre Jaccard, Geophysical Institute, University of Bergen, 1999
