mean
Arithmetic mean.
Syntax
Section titled “Syntax”M = mean(A)M = mean(A, dim)M = mean(A, flag)Description
Section titled “Description”Returns the arithmetic mean of A. With no second argument, averages along the first non-singleton dimension. With a numeric dim, averages along that dimension. The optional flag ('omitnan' / 'includenan') controls NaN handling — default is to skip NaN values.
Examples
Section titled “Examples”mean([1 2 3 4 5]) % 3mean([1 2; 3 4]) % [2 3] column meansmean([1 2; 3 4], 2) % [1.5; 3.5] row meansSee also
Section titled “See also”median— Median value.std— Standard deviation.var— Variance.rms— Root mean square.sum— Sum elements of an array.
Also categorized under: Range Functions / Math.