File Exchange

image thumbnail

gmean

version 1.0.0.0 (2.39 KB) by Antonio Trujillo-Ortiz
Generalized mean.

3 Downloads

Updated 08 Apr 2008

View License

A generalized mean, also known as power mean, Holder mean or Kolmogorov-Negumo function of the mean, is an abstraction of the Pythagorean means included harmonic, geometric, and arithmetic mean.

It is defined as,

Mk = [1/n(x1^k + x2^k + ... + xn^k)]^1/k

where: k is indicator power for the desired mean (-1 = harmonic mean; 0 = geometric mean; 1 = arithmetic mean;2 = root mean square).

Although it is not possible to put k = 0 directly but, according to the L’Hopital’s theorem, the limit as k tends to zero exists,

Mk = lim k->0 [1/n(x1^k + x2^k + ... + xn^k)]^1/k = (x1x2 ... xn)^1/k

Input:
x - Input data vector
k - desired power (-1 = harmonic mean ;0 = geometric mean;1 = arithmetic mean;2 = root mean square)

Output:
y - Desired mean

Cite As

Antonio Trujillo-Ortiz (2021). gmean (https://www.mathworks.com/matlabcentral/fileexchange/19469-gmean), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!