Fits a function to the specified points.

Namespace:  CenterSpace.NMath.Analysis
Assembly:  NMath (in NMath.dll) Version: 5.1.0.0

Syntax

C#
public DoubleVector Fit(
	DoubleVector xValues,
	DoubleVector yValues,
	DoubleVector initialParameters,
	DoubleVector parameterLowerBounds,
	DoubleVector parameterUpperBounds
)
Visual Basic (Declaration)
Public Function Fit ( _
	xValues As DoubleVector, _
	yValues As DoubleVector, _
	initialParameters As DoubleVector, _
	parameterLowerBounds As DoubleVector, _
	parameterUpperBounds As DoubleVector _
) As DoubleVector
Visual C++
public:
DoubleVector^ Fit(
	DoubleVector^ xValues, 
	DoubleVector^ yValues, 
	DoubleVector^ initialParameters, 
	DoubleVector^ parameterLowerBounds, 
	DoubleVector^ parameterUpperBounds
)

Parameters

xValues
Type: CenterSpace.NMath.Core..::.DoubleVector
parameters values of the points to fit.
yValues
Type: CenterSpace.NMath.Core..::.DoubleVector
yValues values of the points to fit.
initialParameters
Type: CenterSpace.NMath.Core..::.DoubleVector
The starting function parameters.
parameterLowerBounds
Type: CenterSpace.NMath.Core..::.DoubleVector
Lower bounds for the solution parameters p, such that parameterLowerBounds[i] <= p[i].
parameterUpperBounds
Type: CenterSpace.NMath.Core..::.DoubleVector
Upper bounds for the solution parameters p, such that parameterUpperBounds[i] >= p[i].

Return Value

The parameters of the function at the minimum.

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.

Exceptions

ExceptionCondition
CenterSpace.NMath.Core..::.InvalidArgumentException Thrown if the vectors of parameters and yValues values have different lengths, or if the number of points is not greater than or equal to the number of function parameters.

See Also