Programmer Guide/Command Reference/EVAL/avr: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 7: Line 7:
:;<var>x</var>: a scalar, vector or matrix
:;<var>x</var>: a scalar, vector or matrix
;Result 1: The result is the arithmetic mean of all elements of <var>x</var>
;Result 1: The result is the arithmetic mean of all elements of <var>x</var>


;Usage 2: '''<code>avr(<var>x</var>, <var>flag</var><code>'''
;Usage 2: '''<code>avr(<var>x</var>, <var>flag</var><code>'''
:;<var>x</var>: a matrix
:;<var>x</var>: a matrix
:;<var>flag</flag>: selects if the average of column vectrors (''flag''==0) or the row vectors (''flag''!=0) is requsted
:;<var>flag</var>: selects if the average of column vectors (''flag''==0) or the row vectors (''flag''!=0) is requsted
 
;Result 2:
:*if flag equals '''0''': the result ''r'' is the vector of the column averages
:::<code>(''r''[''i''] = avr( ''x''[,''i'']); ''i'' = 0 .. ncol(''x'')-1


;See also: [[Programmer_Guide/Command_Reference/EVAL/median|median]], [[Programmer_Guide/Command_Reference/EVAL/dev|dev]], [[Programmer_Guide/Command_Reference/EVAL/sum|sum]], [[Programmer_Guide/Command_Reference/EVAL/hist|hist]],
;See also: [[Programmer_Guide/Command_Reference/EVAL/median|median]], [[Programmer_Guide/Command_Reference/EVAL/dev|dev]], [[Programmer_Guide/Command_Reference/EVAL/sum|sum]], [[Programmer_Guide/Command_Reference/EVAL/hist|hist]],


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Revision as of 11:03, 4 April 2011


Compute the arithmetic mean (average). This function is implemented in two versions. The function avg is an alias for this function. Returns the largest absolute value found in the arguments.

Usage 1
avr(x)
x
a scalar, vector or matrix
Result 1
The result is the arithmetic mean of all elements of x


Usage 2
avr(x, flag
x
a matrix
flag
selects if the average of column vectors (flag==0) or the row vectors (flag!=0) is requsted
Result 2
  • if flag equals 0: the result r is the vector of the column averages
(r[i] = avr( x[,i]); i = 0 .. ncol(x)-1
See also
median, dev, sum, hist,

<function list>

Navigation menu

Personal tools