Change language to:
English - Français - Português - Русский

See the recommended documentation of this function

Scilabヘルプ >> Statistics > Mean Central Tendency > harmean

# harmean

### 呼び出し手順

```hm = harmean(x)
hm = harmean(x, 'r'|1 )
hm = harmean(x, 'c'|2 )```

### パラメータ

x

vector, matrix, or hypermatrix of real or complex numbers or polynomials. Rationals not supported.

hm

scalar, or row (if `"r"` is used), or column (if `"c"` is used). If `x` are polynomials, `hm` is of rational type.

### 説明

This function computes the harmonic mean of input values = inverse of the average of inversed non-zero values.

`hm = harmean(x,'r')` (または等価な `hm = harmean(x,1)`) は, 行ベクトル`hm`の各要素に `x`の各列の調和平均を返します.

`hm = harmean(x,'c')` (または等価な `hm = harmean(x,2)` ) は, 列ベクトル`hm`の各エントリに `x`の各行の調和平均を返します.

 If `x` is an hypermatrix and a `"r", 1, "c", 2` flag is used, an error occurs.

### Examples

```harmean(1:10) // Returns 1 / mean(1 ./(1:10))
h = harmean([1 1 0 1 0 1])  // returns 1: zeros are not considered
1 / mean(1./[1 1 0 1 0 1])  // returns 0, as soon as a zero is present

x = grand(3, 4, "uin",-10, 10)
harmean(x)
harmean(x, "r")
harmean(x, 2)

// Hypermatrix
x = grand(3,4,2, "uin",-10, 10)
harmean(x)
harmean(x, "r") // error: not supported
harmean(x, 3)   // error: not supported

harmean([%z 0])
harmean([%z %z/2])
harmean([%z %i+%z])
harmean([%z %i+%z]) == 1 / ((1/%z + 1/(%i+%z))/2)```

### 参考文献

Wonacott, T.H. & Wonacott, R.J.; Introductory Statistics, fifth edition, J.Wiley & Sons, 1990.