Re: Savgol - Differentiation problems [message #37969] |
Fri, 13 February 2004 01:01 |
richard.martin
Messages: 3 Registered: February 2004
|
Junior Member |
|
|
Worked it out now - a real IDL gotcha this one;
SAVGOL essentially fits a polynomial around a local group of data points,
which can then be differentiated to give numerical derivatives. The SAVGOL
function returns a set of filter coefficients based on the leading term of
the polynomial.
However, when a higher order derivative is specified, the parameter
instructs the routine to return the nth coefficient of the polynomial NOT
the leading coefficient of the polynomial differentiated n times. Of course
this is the same thing, but different by a factor of n!. Of course IDL
completely fail to mention this in their documentation. Along with the need
to divide by the stepsize^n.
In other words, nth derivative output from the SAVGOL/CONVOL combination
needs to multiplied by n!/((x[1]-x[0])^n), where x is the abscissa. You do
sometimes wonder whether the IDL people have read the text in NR at all.
Dave
|
|
|