Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - Português


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

  • mean — mean of all values, or means along a given dimension
  • stdevf — standard deviation
  • variancef — variance (and mean) of a vector or matrix of frequency-weighted real or complex numbers

Bibliography

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

Report an issue
<< mean Mean Central Tendency median >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:53:24 CEST 2024