Difference between revisions of "ApCoCoA-1:Num.SavGol"

From ApCoCoAWiki
m (fixed links to namespace ApCoCoA)
m (insert version info)
 
Line 1: Line 1:
 +
{{Version|1}}
 
<command>
 
<command>
 
   <title>Num.SavGol</title>
 
   <title>Num.SavGol</title>

Latest revision as of 10:30, 7 October 2020

This article is about a function from ApCoCoA-1.

Num.SavGol

Compute numerical derivatives of equally spaced data using local polynomial regression.

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 data series assuming that the data points are equally spaced.

Each data series is considered as a column of the matrix Points. It is assumed that the spacing StepWidth is the same for all columns. The polynomial degree Deg must be less than the window size Nl+Nr+1. The derivatives are computed up to order MaxDiffOrd.

The resulting matrix has Nl+Nr rows less than Points and has MaxDiffOrd+1 times more columns as Points. The first MaxDiffOrd+1 columns correspond to the 0-th, 1-st,...,MaxDiffOrd-th derivatives of the first column of Points, and so on.

  • @param Points The data points for which numerical derivatives are computed, each data series is considered as a column.

  • @param MaxDiffOrd The order up to which derivatives are computed.

  • @param Nl Number of left data points to be considered.

  • @param Nr Number of right data points to be considered.

  • @param Deg Maximum degree of the interpolation polynomal. Must be greater or equal MaxOrd.

  • @return A matrix that represents the derivatives of Points up to order MaxDiffOrd.


Example

Points := Mat([[ Fn.SinN(I/2, 10), Fn.CosN(I/2, 10) ] | I In 0..40 ]);

MaxDiffOrd := 3;
Nl := 4;
Nr := 4;
Deg := 3;
Mode := 0; -- Mode is currently not used!
StepWidth := 0.5;

Result := Num.SavGol(Points, MaxDiffOrd, Nl, Nr, Deg, Mode, StepWidth);
Dec(Result, 2); ]])

-- (Result) --
Mat([
  [<quote>0.84</quote>, <quote>0.40</quote>, <quote>0.63</quote>, <quote>0.31</quote>, <quote>0.38</quote>, <quote>0.87</quote>, <quote>0.29</quote>, <quote>0.69</quote>]
  [<quote>0.55</quote>, <quote>0.77</quote>, <quote>0.41</quote>, <quote>0.61</quote>, <quote>0.74</quote>, <quote>0.57</quote>, <quote>0.56</quote>, <quote>0.45</quote>]
[...]

See also

Num.DABM