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

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====avr=====


Compute the arithmetic average.
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:=====
;Usage 1: '''<code>avr(<var>x</var>)</code>'''
:;<var>x</var>: a scalar, vector or matrix
;Result 1: The result is the arithmetic mean of all elements of <var>x</var>


<code>avr(<var>x</var>)</code>
;Usage 2: '''<code>avr(<var>x</var>, <var>flag</var><code>'''
:;<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


=====Function:=====


Compute the arithmetic average of all elements in <var>x</var>.
;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]],


=====Result:=====
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
 
The arithmetic average of all the elements.
 
=====Return Type:=====
 
scalar
 
=====Usage:=====
 
<code>avr(<var>x</var>, <var>flag</var>)</code>
 
=====Function:=====
 
Compute the arithmetic average of each column or row of the matrix <var>x</var>.
 
=====Parameters:=====
 
;<var>x</var>
 
:A matrix.
 
;<var>flag</var>
 
:A flag determining whether the returned vector contains elements of the averaged column <code>i</code> (<var>type</var><code>=0</code>) or averaged row <code>i</code> (<var>type</var><code>=1</code>).
 
=====Result:=====
 
A vector with <code>ncol(</code><var>x</var><code>)</code> or <code>nrow(</code><var>x</var><code>)</code> elements.
 
=====Return Type:=====
 
vector

Revision as of 11:00, 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</flag>: selects if the average of column vectrors (flag==0) or the row vectors (flag!=0) is requsted


See also
median, dev, sum, hist,

<function list>

Navigation menu

Personal tools