Function mean
Compute the mean value of matrix or a list with values.
In case of a multi dimensional array, the mean of the flattened array
will be calculated. When dim
is provided, the maximum over the selected
dimension will be calculated. Parameter dim
is zero-based.
Syntax
mean(a, b, c, ...)
mean(A)
mean(A, dim)
Parameters
Parameter |
Type |
Description |
args |
... * |
A single matrix or or multiple scalar values |
Returns
Type |
Description |
* |
The mean of all values |
Examples
mean(2, 1, 4, 3); // returns 2.5
mean([1, 2.7, 3.2, 4]); // returns 2.725
mean([[2, 5], [6, 3], [1, 7]], 0); // returns [3, 5]
mean([[2, 5], [6, 3], [1, 7]], 1); // returns [3.5, 4.5, 4]
See also
median,
min,
max,
sum,
prod,
std,
var