sum

From STX Wiki
Jump to navigationJump to search

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
us is the lowest index, os the highest and n the number of extents. All three arguments are scalars. Every pair {'us'+d*k, us+d*(k+1)} (with: d=(os-us)/n, k=0..n-1) defines an index extent to sum.
uv, ov
Every pair {uv[k], ov[k]} (with: k=0..nrow(uv)-1) defines an index extent to sum. Both arguments must be vectors with same length.
rv
Every pair {rv[k], rv[k+1]} (with: k=0..nrow(rv)-2) defines an index extent to sum. The argument must be vector.
rm
Every pair {rm[k,0], rm[k,1]} (with: k=0..nrow(rm)-1) 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 ri is the sum of the x values over the i-th index extent.
See also
wsum, hist

<function list>

Navigation menu

Personal tools