% -*- texinfo -*- % @deftypefn {Function File} {} median (@var{x}, @var{dim}) % If @var{x} is a vector, compute the median value of the elements of % @var{x}. If the elements of @var{x} are sorted, the median is defined % as % @tex % $$ % {\rm median} (x) = % \cases{x(\lceil N/2\rceil), & $N$ odd;\cr % (x(N/2)+x(N/2+1))/2, & $N$ even.} % $$ % @end tex % @ifnottex % % @example % @group % x(ceil(N/2)), N odd % median(x) = % (x(N/2) + x((N/2)+1))/2, N even % @end group % @end example % @end ifnottex % If @var{x} is a matrix, compute the median value for each % column and return them in a row vector. If the optional @var{dim} % argument is given, operate along this dimension. % @seealso{std, mean} % @end deftypefn