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....



SmoothedSpline


Unit:SDL_math2
Class: TCurveFit
Declaration: function SmoothedSpline (x: double; var FitQual: double; var valid: boolean): double;

Splines are normally used for the interpolation between known data points. The resulting function runs through the data points and has a smooth first derivative and a continuous second derivative. However, splines exhibit a major drawback if the data points are subject to noise. In such circumstances one may have the need for a smoothed interpolation.

The method SmoothedSpline implements such a smoothed interpolation. The degree of smoothing may be controlled by the property SplineSmoothingFactor which may assume values between 0.0 and 1.0 The following figure shows the smoothed cubic spline for three different smoothing factors. A value of 0.0 means no smoothing, a value of 1.0 creates a linear least squares fit.

The method SmoothedSpline calculates the value of the smoothed spline function at the argument x using the data points as specifed by EnterStatValue and the smoothing factor SplineSmoothingFactor. The variable parameter FitQual returns the quality of fit of the smoothed spline, the parameter valid it TRUE if the returned function value is valid (i.e. it is within the range of the known data points).

Hint: Please note that the execution speed of the method SmoothedSpline may be considerably lower for the first calculation after changing any of the parameters, since the changing of a parameter triggers the solving of a set of equations.

Example: This method is used in the following example program (see http://www.lohninger.com/examples.html for downloading the code): curvefit, spline



Last Update: 2012-Oct-20