Click or drag to resize

OneVariableFunctionFitterM Class

Class OneVariableFunctionFitter fits a parameterized one variable function to a set of points.
Inheritance Hierarchy
SystemObject
  CenterSpace.NMath.CoreOneVariableFunctionFitterM
    CenterSpace.NMath.CoreBoundedOneVariableFunctionFitterM

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.3
Syntax
public class OneVariableFunctionFitter<M> : ICloneable
where M : new(), INonlinearLeastSqMinimizer

Type Parameters

M

[Missing <typeparam name="M"/> documentation for "T:CenterSpace.NMath.Core.OneVariableFunctionFitter`1"]

The OneVariableFunctionFitterM type exposes the following members.

Constructors
  NameDescription
Protected methodOneVariableFunctionFitterM(Boolean)
For internal use only.
Public methodOneVariableFunctionFitterM(DoubleParameterizedFunction)
Constructs a OneVariableFunctionFitter instance with the given parameterized function.
Public methodOneVariableFunctionFitterM(FuncDoubleVector, Double, Double)
Constructs a OneVariableFunctionFitter instance with the given parameterized function delegate.
Public methodOneVariableFunctionFitterM(DoubleParameterizedFunction, M)
Constructs a OneVariableFunctionFitter instance with the given parameterized function and minimizer.
Public methodOneVariableFunctionFitterM(FuncDoubleVector, Double, Double, M)
Constructs a OneVariableFunctionFitter instance with the given parameterized function and minimizer.
Top
Properties
  NameDescription
Public propertyFunction
Gets and sets the parameterized function.
Public propertyMinimizer
Gets and sets the function minimizer.
Top
Methods
  NameDescription
Public methodClone
Creates a deep copy of this OneVariableFunctionFitter.
Public methodFit(DoubleVector, DoubleVector, DoubleVector)
Fits a function to the specified points.
Public methodFit(DoubleVector, DoubleVector, DoubleVector, DoubleVector)
Fits a function to the specified points.
Public methodResidualVector
Computes the residual vector from the given data points and solution.
Public methodWeightedResidualVector
Computes the residual vector from the given data points and solution.
Top
Fields
  NameDescription
Protected fieldminimizer_
The nonlinear least squares minimizer to use.
Protected fieldparameterizedFunction_
Parameterized funtion.
Protected fieldresidualFunction_
The actual funtion minimized by the minimizer.
Top
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 a nonlinear least squares minimization to compute the solution. 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.
OneVariableFunctionFitter<TrustRegionMinimizer>; fitter = new OneVariableFunctionFitter<TrustRegionMinimizer>(NMathFunctions.FourParameterLogistic);

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);
Note that problems can have multiple local minima. Trying different initial parameter points is recommended for better solutions.
See Also