DeriveSpectrum

Declaration: DeriveSpectrum(var Spectrum: TDoubleArray; Order, WindowSize: integer): integer;
Calculates the (smoothed) first and second derivative of the data in the variable Spectrum. The data in the Spectrum array are replaced by the calculated derivative. The parameter Order specifies the type of derivative (Order may assume 1 or 2). The parameter WindowSize defines the size of the smoothing window. The function returns the following error codes:
 0 ... everything is OK
-1 ... wrong Order parameter (only 1 and 2 are allowed)
-2 ... WindowSize is out of range (valid range: 5 to 25)
-3 ... WindowSize must be odd
-4 ... WindowSize must be less than half of the spectral range