The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



SecondDeriv


Unit:SDL_math2
Class:none
Declaration:procedure SecondDeriv (SourceVec: TVector; FirstElem, LastElem: integer; DestVec: TVector; WindowSize: integer);

The procedure SecondDeriv calculates the smoothed second derivative of a series of data by fitting a second order polynomial to the (unsmoothed) second derivative. The number of data points used for estimating the smoothed derivative can be adjusted by setting the parameter WindowSize. It may take values between 5 and 25 and has to be an odd number; any invalid number triggers an ESDLMath2Error exception (see below). The source data series is contained in the vector SourceVec. You may restrict the range of data to be submitted to the derivation algorithm by setting the parameters FirstElem, and LastElem properly. The resulting data series is stored in the vector DestVec (starting at position 1). Please note that the first, and the last (WindowSize div 2) elements cannot be processed and are replaced by the nearest available smoothed value.

Hint: See also the documentation of the procedure PolynomialSmooth for an example which shows the relationships between the various parameters.

SecondDeriv may create the following exceptions of type ESDLMath2Error:

'SecondDeriv: either SourceVec or DestVec is undefined'
'SecondDeriv: specified range for smoothing is smaller than the length of the polynomial'
'SecondDeriv: length of polynomial is out of range'
'SecondDeriv: length of polynomial must be odd'

Note: The algorithm of SecondDeriv has been implemented according to the following paper: A. Savitzky, M.J.E. Golay: Anal.Chem. 36 (1964) 1627



Last Update: 2012-Oct-20