Class OneVariableFunctionFitter fits a generalized one variable function to a set of points.
Namespace:
CenterSpace.NMath.AnalysisAssembly: NMath (in NMath.dll) Version: 5.1.0.0
Syntax
| C# |
|---|
[SerializableAttribute] [ObsoleteAttribute("Replaced by generic class OneVariableFunctionFitter<M> : where M : INonlinearLeastSqMinimizer")] public class OneVariableFunctionFitter : ICloneable |
| Visual Basic (Declaration) |
|---|
<SerializableAttribute> _ <ObsoleteAttribute("Replaced by generic class OneVariableFunctionFitter<M> : where M : INonlinearLeastSqMinimizer")> _ Public Class OneVariableFunctionFitter _ Implements ICloneable |
| Visual C++ |
|---|
[SerializableAttribute] [ObsoleteAttribute(L"Replaced by generic class OneVariableFunctionFitter<M> : where M : INonlinearLeastSqMinimizer")] public ref class OneVariableFunctionFitter : ICloneable |
Remarks
In the space of the function parameters, begining at a specified starting point,
finds a minimum (possibly local) in the sum of the squared residuals with respect to a set of data points.
Uses the Trust Region method of minimization, a variant of the Levenberg-Marquardt method,
to compute the solution. (See TrustRegionMinimizer for more information.) You must supply at least
as many data points to fit as your function has parameters.
For example, the following code fits a 4-parameter logistic function to a set of 10 data points, beginning at point (0.1, 0.1, 0.1, 0.1) in the parameter space.
CopyC#
Note that problems can have multiple local minima. Trying different initial parameter points is recommended for
better solutions.
For example, the following code fits a 4-parameter logistic function to a set of 10 data points, beginning at point (0.1, 0.1, 0.1, 0.1) in the parameter space.
OneVariableFunctionFitter fitter = new OneVariableFunctionFitter(AnalysisFunctions.FourParameterLogisticFunction); DoubleVector xValues = new DoubleVector(55, 64, 70, 76, 80, 90, 72, 65, 86, 75); DoubleVector yValues = new DoubleVector(338, 328, 308, 225, 180, 142, 283, 325, 143, 250); DoubleVector initialParameters = new DoubleVector("0.1 0.1 0.1 0.1"); DoubleVector solution = fitter.Fit(xValues, yValues, initialParameters);