ApCoCoA-1:Num.SavGol
Num.SavGol
Compute numerical derivatives of given time series using the Savitzky-Golay method.
Syntax
SavGol(Points: MAT, MaxDiffOrd:INT, Nl:INT, Nr:INT, Deg:INT, Mode, StepWidth:RAT)
Description
Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.
This command computes numerical derivatives of given time series.
TODO
@param Points The points for which a border basis is computed.
@param GoUpToOrder The order up to which derivatives are taken to construct the model polynomials. It must be between 0 and the maximal differential order MaxOrd in the definition of the current ring.
@param Epsilon A positive rational number describing the maximal admissible least squares error for a polynomial. (Bigger values for Epsilon lead to bigger errors of the polynomials evaluated at the point set). Epsilon should be in the interval (0,1). As a rule of thumb, Epsilon is the expected percentage of error on the input points.
@param Nl Number of left data points to be considered by the Savitzky-Golay filter.
@param Nr Number of right data points to be considered by the Savitzky-Golay filter.
@param Deg Maximum degree of the interpolation polynomial used by Savitzky-Golay filter. Must be greater or equal MaxOrd.
@param CopyReplace Only meaningful, if DoSavGol = 1. Is either c or r. Use c to include (copy) the original time series into the result. Use r to replace the original time series by the filtered results from Savitzky-Golay.
@param DoSavGol Either 0 or 1. Use 0 if the given Points already contain the numerical derivatives up to the required order. Use 1 if the Savitzky-Golay method should be applied to the given Points.
@return The border basis as a list of polynomials.
Example
Use Q[x[1..2,0..3]]; Use Q[x[1..2,0..3]], Ord(DA.DiffTO(<quotes>Ord</quotes>)); Nl := 2; Nr := 2; Deg := 4; GoUpToOrder := 2; Epsilon:=0.1; CopyReplace := "c"; DoSavGol := 1; -- Data is given by [[cos(I), sin(I)] | I In 1..35]. Points := Mat([[0.540302, 0.841471], [-0.416147, 0.909297], [-0.989992, 0.14112], [-0.653644, -0.756802], [0.283662, -0.958924], [0.96017, -0.279415], [0.753902, 0.656987], [-0.1455, 0.989358], [-0.91113, 0.412118], [-0.839072, -0.544021], [0.0044257, -0.99999], [0.843854, -0.536573], [0.907447, 0.420167], [0.136737, 0.990607], [-0.759688, 0.650288], [-0.957659, -0.287903], [-0.275163, -0.961397], [0.660317, -0.750987], [0.988705, 0.149877], [0.408082, 0.912945], [-0.547729, 0.836656], [-0.999961, -0.00885131], [-0.532833, -0.84622], [0.424179, -0.905578], [0.991203, -0.132352], [0.646919, 0.762558], [-0.292139, 0.956376], [-0.962606, 0.270906], [-0.748058, -0.663634], [0.154251, -0.988032], [0.914742, -0.404038], [0.834223, 0.551427], [-0.0132767, 0.999912], [-0.84857, 0.529083], [-0.903692, -0.428183] ]); Result:=Num.DABM(Points, GoUpToOrder, Epsilon, Nl, Nr, Deg, CopyReplace, DoSavGol); Foreach X In Result Do PrintLn Dec(X,2); EndForeach; -- (Result) -- 1 x[1,1] +0.99 x[2,0] -0.00 x[1,0] +0.00 1 x[2,1] +0.00 x[2,0] -0.99 x[1,0] +0.00 [...]
See also