Skip to content

mean

Mean or average

M = mean(A)

  • When A is a scalar, M is equal to A.
  • When A is a vector, M is equal to the mean of elements of A.
  • When A is a matrix or a multidimensional array, an element of M is equal to the mean of elements of the corresponding vector of A along its first non-singleton dimension.

M = mean(A, k)

  • This is the same as the previous cases, except that each element of M corresponds to a vector of A along its k-th dimension.

Note

If a vector contains NaN, the mean of its elements given by mean will be NaN.