Navigation

Operators and Keywords

Function List:

C++ API

: mean (x)
: mean (x, dim)
: mean (x, opt)
: mean (x, dim, opt)

Compute the mean of the elements of the vector x.

The mean is defined as

mean (x) = SUM_i x(i) / N

If x is a matrix, compute the mean for each column and return them in a row vector.

If the optional argument dim is given, operate along this dimension.

The optional argument opt selects the type of mean to compute. The following options are recognized:

"a"

Compute the (ordinary) arithmetic mean. [default]

"g"

Compute the geometric mean.

"h"

Compute the harmonic mean.

Both dim and opt are optional. If both are supplied, either may appear first.

See also: median, mode.

Package: octave