Difference between revisions of "ApCoCoA-1:Num.SavGol"
S schuster (talk | contribs) (New page: <command> <title>Num.SavGol</title> <short_description>Compute numerical derivatives of given time series using the Savitzky-Golay method.</short_description> <syntax> SavGol(Points: MA...) |
S schuster (talk | contribs) |
||
Line 2: | Line 2: | ||
<title>Num.SavGol</title> | <title>Num.SavGol</title> | ||
− | <short_description>Compute numerical derivatives of | + | <short_description>Compute numerical derivatives of equally spaced data using local polynomial regression.</short_description> |
<syntax> | <syntax> | ||
SavGol(Points: MAT, MaxDiffOrd:INT, Nl:INT, Nr:INT, Deg:INT, Mode, StepWidth:RAT) | SavGol(Points: MAT, MaxDiffOrd:INT, Nl:INT, Nr:INT, Deg:INT, Mode, StepWidth:RAT) | ||
Line 11: | Line 11: | ||
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them. | <em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them. | ||
<par/> | <par/> | ||
− | This command computes numerical derivatives of given | + | This command computes numerical derivatives of given data series assuming that the data points are equally spaced. |
<par/> | <par/> | ||
− | + | 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 <tt>Deg</tt> must be less than the window size <tt>Nl+Nr+1</tt>. The derivatives are computed up to order <tt>MaxDiffOrd</tt>. | |
− | + | The resulting matrix has <tt>Nl+Nr</tt> rows less than Points and has <tt>MaxDiffOrd+1</tt> times more columns as Points. The first <tt>MaxDiffOrd+1</tt> columns correspond to the 0-th, 1-st,...,<tt>MaxDiffOrd</tt>-th derivatives of the first column of Points, and so on. | |
<itemize> | <itemize> | ||
− | <item>@param <em>Points</em> The points for which a | + | <item>@param <em>Points</em> The data points for which numerical derivatives are computed, each data series is considered as a column.</item> |
− | <item>@param <em> | + | <item>@param <em>MaxDiffOrd</em> The order up to which derivatives are computed.</item> |
− | + | <item>@param <em>Nl</em> Number of left data points to be considered.</item> | |
− | <item>@param <em>Nl</em> Number of left data points to be considered | + | <item>@param <em>Nr</em> Number of right data points to be considered.</item> |
− | <item>@param <em>Nr</em> Number of right data points to be considered | + | <item>@param <em>Deg</em> Maximum degree of the interpolation polynomal. Must be greater or equal MaxOrd. |
− | <item>@param <em>Deg</em> Maximum degree of the interpolation | ||
</item> | </item> | ||
− | <item>@ | + | <item>@return A matrix that represents the derivatives of Points up to order <tt>MaxDiffOrd</tt>.</item> |
− | |||
− | < | ||
</itemize> | </itemize> | ||
<example> | <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. | + | Result := Num.SavGol(Points, MaxDiffOrd, Nl, Nr, Deg, Mode, StepWidth); |
− | + | Dec(Result, 2); ]]) | |
− | |||
− | |||
-- (Result) -- | -- (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>] | |
[...] | [...] | ||
Line 71: | Line 49: | ||
<seealso> | <seealso> | ||
− | + | <see>Num.DABM</see> | |
− | <see>Num. | ||
− | |||
− | |||
</seealso> | </seealso> | ||
<types> | <types> | ||
Line 80: | Line 55: | ||
<type>points</type> | <type>points</type> | ||
</types> | </types> | ||
− | <key> | + | <key>SavGol</key> |
− | <key>Num. | + | <key>Num.SavGol</key> |
− | <key>numerical. | + | <key>numerical.SavGol</key> |
<wiki-category>Package_numerical</wiki-category> | <wiki-category>Package_numerical</wiki-category> | ||
</command> | </command> |
Revision as of 10:19, 17 May 2013
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