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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(30 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Apply a smoothing to the vector <var>x</var>.
Apply smoothing to the vector or matrix <var>x</var>.
;Usage:<code>smooth(<var>x</var> {, <var>type</var>=0 {, <var>m</var>=1 {, <var>s</var>=1}}})</code>
;Usage:<code>smooth(<var>x</var> {, <var>type</var>=0 {, <var>m</var>=1 {, <var>s</var>=1}}})</code>
:;<var>x</var>:data vector
:;<var>x</var>:data vector or matrix
:;<var>m</var>:smoothing length; 0 < ''m'' <= <code>nrow(''x'')/2</code> (default=1)
:;<var>m</var>:smoothing length; 0 < ''m'' &le; <code>nrow(''x'')/2</code> (default=1)
:;<var>type</var>:selects the smoothing algorithm (default=0)
:;<var>type</var>:selects the weighting coefficients (default=0)
:;<var>s</var>output step size; 0 < ''s'' <= <code>nrow(''x'')/2</code> (default=1)
:;<var>s</var>:output step size; 0 < ''s'' &le; <code>nrow(''x'')/2</code> (default=1)
;Description:
;Description: The smoothed value ''xs''[i] is computed from the data values ''x''[i-m] to ''x''[i+m]. The general form of the smoothing function is:
The smoothing function is selected by the argument ''type''. The smoothed value ''xs''[i] is computed from the data values ''x''[i-m] to ''x''[i+m]. The general form of the smoothing function is:
::<math>xs[i] = \frac{ \sum_{j=-m}^m{x[i+j].w[j]} }{ \sum_{j=-m}^m{w[j]} }</math>
<math>\sum{j=i-m,i+m}\prod{x[j],w[j]}</math>
:The weighting coefficients ''w''[i] depend on the value of the argument ''type''
{|class="einrahmen"  
::{|class="einrahmen"  
!''type'' !! smoothing algorithm !! ''xs''[i] =
!''type'' !! ''w''[j] !!
|-
|-
|'''0'''  
|'''0''' ||1 ||average
|average
|(''x''[i-''m'']+''x''[i-''m''+1]+..+''x''[i]+..+''x''[i+''m''-1]+ x[i+''m'']) / (2*''m''+1)
|-
|-
|'''0'''  
|'''1''' |||<nowiki>1 / (|j|+1)</nowiki> ||''distance'' weighted average
|average with reciprocal weights
|(''x''[i-''m'']/(m+1)''x''[i-''m''+1]/m+..+''x''[i]+..+''x''[i+''m''-1]/m+ x[i+''m'']/(m+1)) / (1 + 2*''m''+1)
|}
|}
;Result: A vector r with <code>nrow(''x'')/s</code> elements. The value ''r''[j] is set to the value ''xs''[j*s] of the smoothed data vector.
;Result: A vector or matrix ''r'' with <code>nrow(''x'')/s</code> rows and the same number of clumns as <code>''x''</code>. The value ''r''[j] is set to the value ''xs''[j*s] of the smoothed data vector.
;See also: [[../optmm|optmm]]
 
[[../#Functions|<function list>]]

Latest revision as of 11:09, 12 May 2017

Apply smoothing to the vector or matrix x.

Usage
smooth(x {, type=0 {, m=1 {, s=1}}})
x
data vector or matrix
m
smoothing length; 0 < mnrow(x)/2 (default=1)
type
selects the weighting coefficients (default=0)
s
output step size; 0 < snrow(x)/2 (default=1)
Description
The smoothed value xs[i] is computed from the data values x[i-m] to x[i+m]. The general form of the smoothing function is:
{\displaystyle xs[i]={\frac {\sum _{j=-m}^{m}{x[i+j].w[j]}}{\sum _{j=-m}^{m}{w[j]}}}}
The weighting coefficients w[i] depend on the value of the argument type
type w[j]
0 1 average
1 1 / (|j|+1) distance weighted average
Result
A vector or matrix r with nrow(x)/s rows and the same number of clumns as x. The value r[j] is set to the value xs[j*s] of the smoothed data vector.
See also
optmm

<function list>

Navigation menu

Personal tools