MATLAB Functions Help Desk

Purpose

Average or mean value of arrays

Syntax

```M =` `mean(A)
M = mean(A,dim)
```

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`.

Examples

```A = [1 2 4 4; 3 4 6 6; 5 6 8 8; 5 6 8 8];
mean(A)
ans =
3.5000    4.5000    6.5000    6.5000

mean(A,2)
ans =
2.7500
4.7500
6.7500
6.7500
```

`corrcoef``    `Correlation coefficients

`cov``         `Covariance matrix

`max``         `Maximum elements of an array

`median``      `Median value of arrays

`min``         `Minimum elements of an array

`std``         `Standard deviation

[ Previous | Help Desk | Next ]