Programmer Guide/Command Reference/EVAL/sum: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
Calculate the summation over one or more user-defined extents of a vector <var>x</var>. Depending on the number of extents, the result of the function is a vector or a scalar. | Calculate the summation over one or more user-defined extents of a vector <var>x</var>. Depending on the number of extents, the result of the function is a vector or a scalar. | ||
;Usage: | ;Usage: | ||
: | :<code>sum(<var>x</var>, <var>us</var>, <var>os</var>, <var>n</var>)</code> | ||
:'''<code>sum(<var>x</var>, <var>uv</var>, <var>ov</var>)</code> | :'''<code>sum(<var>x</var>, <var>uv</var>, <var>ov</var>)</code> | ||
: | :<code>sum(<var>x</var>, <var>rv</var>)</code> | ||
: | :<code>sum(<var>x</var>, <var>rm</var>)</code> | ||
:;<var>x</var>: the data vector | :;<var>x</var>: the data vector | ||
:;<var>us, os, n</var>: | :;<var>us, os, n</var>: Every pair <code>{''us''+d*i, ''us''+d*(i+1)} (with: d=(''os''-''us'')/n, i=0..n-1)</code> defines an index extent to sum. All three arguments are scalars. | ||
:;<var>uv, ov</var>: Every pair <code>{''uv''[ | :;<var>uv, ov</var>: Every pair <code>{''uv''[i], ''ov''[i]} (with: i=0..nrow(''uv'')-1)</code> defines an index extent to sum. Both arguments must be vectors with same length. | ||
:;<var>rv</var>: Every pair <code>{''rv''[ | :;<var>rv</var>: Every pair <code>{''rv''[i], ''rv''[i+1]} (with: i=0..nrow(''rv'')-2)</code> defines an index extent to sum. The argument must be vector. | ||
:;<var>rm</var>: Every pair <code>{''rm''[ | :;<var>rm</var>: Every pair <code>{''rm''[i,0], ''rm''[i,1]} (with: i=0..nrow(''rm'')-1)</code> defines an index extent to sum. The argument must be matrix with 2 columns. | ||
;Result: The result ''r'' is a scalar or a vector. Each element ''r''<sub>i</sub> is the sum of the ''x'' values over the i-th index extent. | ;Result: The result ''r'' is a scalar or a vector. Each element ''r''<sub>i</sub> is the sum of the ''x'' values over the i-th index extent. | ||
;See also: [[ | ;See also: [[../wsum|wsum]], [[../hist|hist]], [[../avr|avr]] | ||
[[ | [[../#Functions|<function list>]] |
Latest revision as of 11:59, 21 April 2011
Calculate the summation over one or more user-defined extents of a vector x. Depending on the number of extents, the result of the function is a vector or a scalar.
- Usage
sum(x, us, os, n)
sum(x, uv, ov)
sum(x, rv)
sum(x, rm)
- x
- the data vector
- us, os, n
- Every pair
{us+d*i, us+d*(i+1)} (with: d=(os-us)/n, i=0..n-1)
defines an index extent to sum. All three arguments are scalars. - uv, ov
- Every pair
{uv[i], ov[i]} (with: i=0..nrow(uv)-1)
defines an index extent to sum. Both arguments must be vectors with same length. - rv
- Every pair
{rv[i], rv[i+1]} (with: i=0..nrow(rv)-2)
defines an index extent to sum. The argument must be vector. - rm
- Every pair
{rm[i,0], rm[i,1]} (with: i=0..nrow(rm)-1)
defines an index extent to sum. The argument must be matrix with 2 columns.