Programmer Guide/Command Reference/EVAL/avr: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
:;<var>flag</var>: selects if the average of the column vectors (''flag''=0) or the row vectors (''flag''≠0) is requsted; ''flag'' must be a scalar | :;<var>flag</var>: selects if the average of the column vectors (''flag''=0) or the row vectors (''flag''≠0) is requsted; ''flag'' must be a scalar | ||
;Result 2: | ;Result 2: | ||
:*if flag | :*if ''flag''=0: the result ''r'' is the vector of the column averages | ||
:::<code>''r''[''i''] = eval avr( ''x''[*,''i'']) // ''i'' = 0 .. ncol(''x'')-1</code> | :::<code>''r''[''i''] = eval avr( ''x''[*,''i'']) // ''i'' = 0 .. ncol(''x'')-1</code> | ||
:*otherwise: the result ''r'' is the vector of the row averages | :*otherwise: the result ''r'' is the vector of the row averages |
Revision as of 10:18, 21 April 2011
The arithmetic mean function is implemented in two versions.
- 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 the column vectors (flag=0) or the row vectors (flag≠0) is requsted; flag must be a scalar
- Result 2
-
- if flag=0: the result r is the vector of the column averages
r[i] = eval avr( x[*,i]) // i = 0 .. ncol(x)-1
- otherwise: the result r is the vector of the row averages
r[i] = eval avr( x[i,*]) // i = 0 .. nrow(x)-1