mean

Returns the mean of X. When x is a matrix the mean for each column and returns them in a row vector.

Syntax

mean(x)

mean(x, dim)

Inputs

x
Any integer
Type: double | integer
Dimension: scalar | vector | matrix
dim
Dimension along which the mean is calculated.
Type: double | integer
Dimension: scalar

Outputs

R
Calculated mean

Example

Simple mean example

mean([1,4,3;6,2,3;1,29, 9])
R = [ 2.6667 11.667 5 ]

Example

Mean example with dim

mean([1,4,3;6,2,3;1,29, 9], 2)
R = [ 2.6667 ; 3.6667 ; 13 ]

Comments

mean(x) = sum(x) / N