mean

Computes mean values.

Syntax

m=mean(x)

m=mean(x,dim,opt)

Inputs

x
Data sample.
Type: double
Dimension: vector | matrix
dim
Dimension on which to perform the calculation.
Default: first non-singleton dimension.
Type: integer
Dimension: scalar
opt
The available options are as follows:
'a'
Arithmetic (default).
'g'
Geometric.

Outputs

m
Mean.
Dimension: scalar | matrix

Examples

Vector example:
x=[9.3, 10.6, 11.9, 13.3, 15.1, 18.2];
m=mean(x)
m = 13.0666667
Matrix example:
x = [9.3, 4.8; 10.6, 6.6; 11.9, 8.0; 13.3, 9.3; 15.1, 10.6; 18.2, 11.9];
m=mean(x)
m = [Matrix] 1 x 2
13.06667  8.53333

Comments

mean(x) = sum(x) / n