Navigation

Operators and Keywords

Function List:

C++ API

Function File: median (x)
Function File: median (x, dim)

Compute the median value of the elements of the vector x.

When the elements of x are sorted, the median is defined as

              x(ceil(N/2))             N odd
median (x) =
             (x(N/2) + x((N/2)+1))/2   N even

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

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

See also: mean, mode.

Package: octave