31.1 Creating PolynomialLeastSquares (.NET, C#, CSharp, VB, Visual Basic, F#)
A PolynomialLeastSquares is constructed from paired vectors of known x- and y-values, and the desired degree of the fitted polynomial. For example, this code fits a cubic:
Code Example – C# polynomial fit
int degree = 4; var fit = new PolynomialLeastSquares( degree, x, y );
Code Example – VB polynomial fit
Dim Degree = 4 Dim Fit As New PolynomialLeastSquares(Degree, X, Y)