harmmean
Harmonic mean
Syntax
Description
returns
the harmonic mean of
m = harmmean(X)X.
If
Xis a vector, thenharmmean(X)is the harmonic mean of the elements inX.If
Xis a matrix, thenharmmean(X)is a row vector containing the harmonic mean of each column ofX.If
Xis a multidimensional array, thenharmmeanoperates along the first nonsingleton dimension ofX.
returns the harmonic mean over the dimensions specified in the vector
m = harmmean(X,vecdim)vecdim. Each element of vecdim represents a
dimension of the input array X. The output m has
length 1 in the specified operating dimensions. The other dimension lengths are the same for
X and m. For example, if X is a
2-by-3-by-4 array, then harmmean(x,[1 2]) returns a 1-by-1-by-4 array.
Each element of the output array is the harmonic mean of the elements on the corresponding
page of X.
specifies whether to exclude m = harmmean(___,nanflag)NaN values from the calculation, using any
of the input argument combinations in previous syntaxes. By default,
harmmean includes NaN values in the calculation
(nanflag has the value "includenan"). To exclude
NaN values, set the value of nanflag to
"omitnan".
