Click or drag to resize

FitPolynomialFunc Method

Least-Squares fitting the points (x,y) to a k-order polynomial y : x -> p0 + p1*x + p2*x^2 + ... + pk*x^k, returning a function y' for the best fitting polynomial. A polynomial with order/degree k has (k+1) coefficients and thus requires at least (k+1) samples.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3572.0 (4.8.3572.0)
Syntax
C#
public static Func<double, double> PolynomialFunc(
	double[] x,
	double[] y,
	int order,
	DirectRegressionMethod method = DirectRegressionMethod.QR
)

Parameters

x  Double
The x values of the sample points.
y  Double
The y values of the sample points.
order  Int32
The polynomial order.
method  DirectRegressionMethod  (Optional)
The direct regression method to use.

Return Value

FuncDouble, Double
A function representing the fitted polynomial.
See Also