Programmer Guide/Command Reference/EVAL/wsum: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 19: | Line 19: | ||
|} | |} | ||
:;<var>s</var>: if this argument is set to '''1''' the sum of each extent is normalized (scaled by <code>1/sum(weights)</code>), otherwise not | :;<var>s</var>: if this argument is set to '''1''' the sum of each extent is normalized (scaled by <code>1/sum(weights)</code>), otherwise not | ||
:;<var>us, os, n</var>: ''us'' is the lowest x-value, ''os'' the highest and ''n'' the number of extents. All three arguments are scalars. Every pair <code>{'us'+d*k, ''us''+d*(k+1)} (with: d=(''os''-''us'')/n, k=0..n-1)</code> defines an extent to sum. | :;<var>us, os, n</var>: ''us'' is the lowest x-value, ''os'' the highest and ''n'' the number of extents. All three arguments are scalars. Every pair <code>{'us'+d*k, ''us''+d*(k+1)} (with: d=(''os''-''us'')/n, k=0..n-1)</code> defines an extent to sum. | ||
:;<var>uv, ov</var>: Every pair <code>{''uv''[k], ''ov''[k]} (with k=0..nrow(''uv'')-1)</code> defines an extent to sum. Both arguments must be vectors with same length. | :;<var>uv, ov</var>: Every pair <code>{''uv''[k], ''ov''[k]} (with k=0..nrow(''uv'')-1)</code> defines an extent to sum. Both arguments must be vectors with same length. | ||
Line 25: | Line 24: | ||
:;<var>rm</var>: Every pair <code>{''rm''[k,0], ''rm''[k,1]} (with k=0..nrow(''rm'')-1)</code> defines an extent to sum. The argument must be matrix with 2 columns. | :;<var>rm</var>: Every pair <code>{''rm''[k,0], ''rm''[k,1]} (with k=0..nrow(''rm'')-1)</code> defines an 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 weighted the ''y '' values over the i-th extent {xmin<sub>i</sub>, xmax<sub<i></sub>}. | ;Result: The result ''r'' is a scalar or a vector. Each element ''r''<sub>i</sub> is the sum of weighted the ''y '' values over the i-th extent {xmin<sub>i</sub>, xmax<sub<i></sub>}. | ||
:Note: an extent is defined by the x-range {xmin, xmax} and not by the indices! | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/sum|sum]], [[Programmer_Guide/Command_Reference/EVAL/hist|hist]] | ;See also: [[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 12:21, 8 April 2011
Calculate the weighted sum over one or more user-defined extents of a function y = f(x). Depending on the number of extents, the result of the function is a vector or a scalar.
- Usage
wsum(x, y, w, s, us, os, n)
sum(x, y, w, s, uv, ov)
sum(x, y, w, s, rv)
sum(x, y, w, s, rm)
- x, y
- the x- and y-data vector; y[i] = f(x[i])
- w
- defines the type of the weighting function
w=0 no weight (rectangle) w=1 triangle w=2 hanning window w=2 hamming window
- s
- if this argument is set to 1 the sum of each extent is normalized (scaled by
1/sum(weights)
), otherwise not - us, os, n
- us is the lowest x-value, 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 extent to sum. - uv, ov
- Every pair
{uv[k], ov[k]} (with k=0..nrow(uv)-1)
defines an 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 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 extent to sum. The argument must be matrix with 2 columns.