Documentation

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 inx. For matrices,geomean(X)is a row vector containing the geometric means of each column. For N-dimensional arrays,geomeanoperates along the first nonsingleton dimension ofX.

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

The geometric mean is

m = [ i = 1 n x i ] 1 n

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a

Was this topic helpful?