Geometric mean

Syntax: s = GMEAN(x)
s = GMEAN(w,x)

The GMEAN function only accepts one or two vector arguments. If only one vector is entered, the function returns the geometric mean of that vector's data. If two vectors are entered, the first vector holds the weights and the second vector holds the data. The result is always a scalar value.

Suppose that x is a vector with N elements.

A weight vector, w, may be entered as the first argument. The length of w is assumed to also be N. If no weights are entered, wj defaults to 1, for j = 1, ..., N. Define the total weight: W = w1 + w2 + ... + wN

The geometric mean, Gx, is defined if each xi ≥ 0 by: Gx = e1/W{w1log(x1) + w2log(x2) + ... + wNlog(xN)}.