FunctionBasis.LeastSquaresFit Method

Definition

Namespace: Numerics.NET.Curves
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.0

Overload List

LeastSquaresFit(Vector<Double>, Vector<Double>) Gets the least squares fit of target data in terms of the components of the FunctionBasis.
LeastSquaresFit(Double[], Double[], Double[]) Gets the least squares fit of target data in terms of the components of the FunctionBasis.
LeastSquaresFit(Double[], Double[], Int32) Gets the least squares fit of target data in terms of the components of the FunctionBasis.
LeastSquaresFit(Vector<Double>, Vector<Double>, Vector<Double>) Gets the least squares fit of target data in terms of the components of the FunctionBasis.

LeastSquaresFit(Vector<Double>, Vector<Double>)

Gets the least squares fit of target data in terms of the components of the FunctionBasis.
C#
public virtual LinearCombination LeastSquaresFit(
	Vector<double> xValues,
	Vector<double> yValues
)

Parameters

xValues  Vector<Double>
A vector containing the data points for the fit.
yValues  Vector<Double>
A vector containing the data values corresponding to the data points in xValues.

Return Value

LinearCombination
A LinearCombination that is the least squares fit of the data in terms of this FunctionBasis.

Exceptions

ArgumentNullException

xValues is null.

-or-

yValues is null.

TotalLossOfPrecisionException

The solution of the least squares problem could not be found because roundoff error caused a total loss of precision.

DimensionMismatchException

The xValues and yValues do not have the same length.

ArgumentException

The number of data points is less than the number of basis functions.

LeastSquaresFit(Double[], Double[], Double[])

Gets the least squares fit of target data in terms of the components of the FunctionBasis.
C#
public virtual LinearCombination LeastSquaresFit(
	double[] xValues,
	double[] yValues,
	double[] weights
)

Parameters

xValues  Double[]
A Double array containing the data points for the fit.
yValues  Double[]
A Double array containing the data values corresponding to the data points. in xValues.
weights  Double[]
A Double array containing the weights to assign to the residual error corresponding to the data values in yValues.

Return Value

LinearCombination
A LinearCombination that is the least squares fit of the data in terms of this FunctionBasis.

Exceptions

ArgumentNullException

xValues is null.

-or-

yValues is null.

TotalLossOfPrecisionException

The solution of the least squares problem could not be found because roundoff error caused a total loss of precision.

DimensionMismatchException

The xValues and yValues do not have the same length.

ArgumentException

The number of data points is less than the number of basis functions.

LeastSquaresFit(Double[], Double[], Int32)

Gets the least squares fit of target data in terms of the components of the FunctionBasis.
C#
public virtual LinearCombination LeastSquaresFit(
	double[] xValues,
	double[] yValues,
	int numberOfDataPoints
)

Parameters

xValues  Double[]
A Double array containing the data points for the fit.
yValues  Double[]
A Double array containing the data values corresponding to the data points in xValues.
numberOfDataPoints  Int32
The number of actual data points.

Return Value

LinearCombination
A LinearCombination that is the least squares fit of the data in terms of this FunctionBasis.

Remarks

Use this method to calculate a LinearCombination of the basis functions in this instance through a set of points using the least squares method.

Only the first numberOfDataPoints values in xValues and yValues are used.

Exceptions

ArgumentNullException

xValues is null.

-or-

yValues is null.

ArgumentOutOfRangeException

numberOfDataPoints is less than the number of basis functions.

-or-

numberOfDataPoints is greater than the length of xValues.

-or-

numberOfDataPoints is greater than the length of yValues.

TotalLossOfPrecisionException

The solution of the least squares problem could not be found because roundoff error caused a total loss of precision.

LeastSquaresFit(Vector<Double>, Vector<Double>, Vector<Double>)

Gets the least squares fit of target data in terms of the components of the FunctionBasis.
C#
public virtual LinearCombination LeastSquaresFit(
	Vector<double> xValues,
	Vector<double> yValues,
	Vector<double>? weights
)

Parameters

xValues  Vector<Double>
A vector containing the data points for the fit.
yValues  Vector<Double>
A vector containing the data values corresponding to the data points in xValues.
weights  Vector<Double>
A vector containing the weights to assign to the residual error corresponding to the data values in yValues.

Return Value

LinearCombination
A LinearCombination that is the least squares fit of the data in terms of this FunctionBasis.

Exceptions

ArgumentNullException

xValues is null.

-or-

yValues is null.

TotalLossOfPrecisionException

The solution of the least squares problem could not be found because roundoff error caused a total loss of precision.

DimensionMismatchException

The xValues and yValues do not have the same length.

ArgumentException

The number of data points is less than the number of basis functions.

See Also