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

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 7: Line 7:
:;<var>s</var>output step size; 0 < ''s'' <= <code>nrow(''x'')/2</code> (default=1)
:;<var>s</var>output step size; 0 < ''s'' <= <code>nrow(''x'')/2</code> (default=1)
;Description:
;Description:
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 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>x+y</math>
{|class="einrahmen"  
{|class="einrahmen"  
!''type'' !! smoothing algorithm !! ''xs''[i] =
!''type'' !! smoothing algorithm !! ''xs''[i] =
Line 13: Line 14:
|'''0'''  
|'''0'''  
|average
|average
|(''x''[i-''m'']+''x''[i-''m''+1)]+..+''x''[i]+..+''x''[i+''m''-1]+ x[i+''m'']) / (2*''m''+1)
|(''x''[i-''m'']+''x''[i-''m''+1]+..+''x''[i]+..+''x''[i+''m''-1]+ x[i+''m'']) / (2*''m''+1)
|-
|-
|'''0'''  
|'''0'''  
|average with triangle weights
|average with reciprocal weights
|(''x''[i-''m'']/m + .. + x[i] + .. + x[i+''m'']) / (2*''m''+1)
|(''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 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.

Revision as of 13:30, 13 April 2011

Apply a smoothing to the vector x.

Usage
smooth(x {, type=0 {, m=1 {, s=1}}})
x
data vector
m
smoothing length; 0 < m <= nrow(x)/2 (default=1)
type
selects the smoothing algorithm (default=0)
soutput step size; 0 < s <= nrow(x)/2 (default=1)
Description

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: {\displaystyle x+y}

type smoothing algorithm xs[i] =
0 average (x[i-m]+x[i-m+1]+..+x[i]+..+x[i+m-1]+ x[i+m]) / (2*m+1)
0 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 nrow(x)/s elements. The value r[j] is set to the value xs[j*s] of the smoothed data vector.

Navigation menu

Personal tools