Skip to content

median

Median value.

M = median(A)
M = median(A, dim)

Returns the median (50th percentile) of A. For even-length vectors, returns the average of the two middle values. Operates along the first non-singleton dimension by default; pass dim to override.

median([1 2 3 4]) % 2.5
median([1 5 100]) % 5 (robust to outliers)
  • mean — Arithmetic mean.
  • std — Standard deviation.
  • var — Variance.

Also categorized under: Range Functions / Math.