Click or drag to resize

OneVariableFunctionFitterMFit(DoubleVector, DoubleVector, DoubleVector, DoubleVector) Method

Fits a function to the specified points.

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
public DoubleVector Fit(
	DoubleVector xValues,
	DoubleVector yValues,
	DoubleVector yWeights,
	DoubleVector initialParameters
)

Parameters

xValues  DoubleVector
parameters values of the points to fit.
yValues  DoubleVector
yValues values of the points to fit.
yWeights  DoubleVector
Weights for the y-values. The objective function of residuals will be weighted by these values. Must have the same length as the xValues and yValues vectors and must contian only positive values
initialParameters  DoubleVector
The starting function parameters.

Return Value

DoubleVector
The parameters of the function at the minimum.
Exceptions
ExceptionCondition
InvalidArgumentException Thrown if the vectors of xValues, yValues and weights have different lengths, or if the number of points is not greater than or equal to the number of function parameters. Thrown if the weights vector does contains non-positive values.
Remarks
In the space of the function parameters, begining at the specified starting point (initialParameters), finds a minimum (possibly local) with respect to the sum of the squared residuals, where residuals[i] = ( yValues[i] - f( currentParameters, xValues[i] )^2.
Note that problems can have multiple local minima. Trying different initial points is recommended for better solutions.
See Also