geomean

Geometric mean

Syntax

m = geomean(x)
geomean(X,dim)

Description

m = geomean(x) calculates the geometric mean of a sample. For vectors, geomean(x) is the geometric mean of the elements in x. For matrices, geomean(X) is a row vector containing the geometric means of each column. For N-dimensional arrays, geomean operates along the first nonsingleton dimension of X.

geomean(X,dim) takes the geometric mean along the dimension dim of X.

The geometric mean is

m=[i=1nxi]1n

Examples

The arithmetic mean is greater than or equal to the geometric mean.

x = exprnd(1,10,6);

geometric = geomean(x)
geometric =
  0.7466  0.6061  0.6038  0.2569  0.7539  0.3478

average = mean(x)
average =
  1.3509  1.1583  0.9741  0.5319  1.0088  0.8122
Was this topic helpful?