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



CalcGaussFit


Unit:SDL_math2
Class:TCurveFit
Declaration:procedure CalcGaussFit (var k0, k1, k2, FitQual: double);

The procedure CalcGaussFit calculates the best fitting Gaussian curve (normal distribution) for a given set of data. The curve is determined by the equation

The values of x and y are given by the data samples, the parameters k0, k1, and k2 are estimated by CalcGaussFit using a least squares approximation.

The data points [x,y] have to be entered using the routine EnterStatValue. A minimum number of 3 values is required in order to apply CalcGaussFit. Do not forget to reset the statistics calculation before entering any new data sets (use the method Init)

In addition to the parameters k0, k1, and k2  CalcGaussFit returns the goodness of fit FitQual. This parameter may vary between 0.0 and 1.0, indicating the best possible fit if FitQual equals 1.0.

Hint 1: The quality of fit calculated by CalcGaussFit is not adjusted for the degree of freedoms in the regression parameters.

Hint 2: The y-values have to be greater than zero. The curve fitting algorithm raises an exception in the case of negative values.

Example: CURVEFIT.DPR
  This application lets you draw points in a chart and calculate various types of regression curves. Note, that CURVEFIT.DPR uses the components RCHART and NUMLAB for the user interface, which are not included in the MATH2 package.

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



Last Update: 2012-Oct-20