Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.

See the recommended documentation of this function

# meanf

weighted mean of a vector or a matrix

### Syntax

m = meanf(x, fre, [orien]) m = meanf(x, fre, 'r') or m = meanf(x, fre, 1) m = meanf(x, fre, 'c') or m = meanf(x, fre, 2)

### Arguments

- x
A real or complex, full or sparse matrix, or an integer matrix, or an hypermatrix.

- fre
A real or complex, full or sparse matrix, or an integer matrix, or an hypermatrix.

- orien
The orientation of the computation. Valid values are

1 or "r": result is a row, after a column-wise computation.

2 or "c": result is a column, after a row-wise computation.

"*": full undirectional computation.

- m
The mean.

### Description

This function computes the mean of a vector or matrix `x`

, each of
them counted with a frequency given by the corresponding values of the integer
vector or matrix `fre`

.

For a vector or matrix `x`

, `m = meanf(x, fre)`

or
`m = meanf(x, fre, "*")`

returns in scalar `m`

the
mean of all the entries of `x`

, each value counted with the
multiplicity indicated by the corresponding value of `fre`

.

`m = meanf(x, fre, 'r')`

(or, equivalently, `m = meanf(x, fre, 1)`

)
returns in each entry of the row vector `m`

the mean
of each column of `x`

.

`m = meanf(x, fre, 'c')`

(or, equivalently, `m = meanf(x, fre, 2)`

)
returns in each entry of the column vector `m`

the mean of
each row of `x`

.

### Examples

x=[0.2113249 0.0002211 0.6653811;0.7560439 0.3303271 0.6283918] m=meanf(x,rand(x)) m=meanf(x,[10 10 10;1 1 1],'r') m=meanf(x,[10 10 10;1 1 1],'c')

### See also

### Bibliography

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

Report an issue | ||

<< mean | Mean Central Tendency | median >> |