smooth

From STX Wiki
Jump to navigationJump to search

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