| MATLAB Function Reference | ![]() |
Average or mean value of arrays
Syntax
Description
M = mean(A)
returns the mean values of the elements along different dimensions of an array.
If A is a vector, mean(A) returns the mean value of A.
If A is a matrix, mean(A) treats the columns of A as vectors, returning a row vector of mean values.
If A is a multidimensional array, mean(A) treats the values along the first non-singleton dimension as vectors, returning an array of mean values.
M = mean(A,dim)
returns the mean values for elements along the dimension of A specified by scalar dim. For matrices, mean(A,2) is a column vector containing the mean value of each row.
Examples
A = [1 2 3; 3 3 6; 4 6 8; 4 7 7]; mean(A) ans = 3.0000 4.5000 6.0000 mean(A,2) ans = 2.0000 4.0000 6.0000 6.0000
See Also
corrcoef, cov, max, median, min, std, var
| max | median | ![]() |
© 1994-2005 The MathWorks, Inc.