functionfitting

Computes the coefficients of a polynomial that fits a set of data points in a least-squares sense

Extends from Modelica.Icons.Function (Icon for functions).

Information

Polynomials.fitting(u,y,n) computes the coefficients of a polynomial p(u) of degree "n" that fits the data "p(u[i]) - y[i]" in a least squares sense. The polynomial is returned as a vector p[n+1] that has the following definition:

p(u) = p[1]*u^n + p[2]*u^(n-1) + ... + p[n]*u + p[n+1];

Inputs

TypeNameDefaultDescription
Real[:]uAbscissa data values
Real[size(u, 1)]yOrdinate data values
IntegernOrder of desired polynomial that fits the data points (u,y)

Outputs

TypeNameDefaultDescription
Real[n + 1]pPolynomial coefficients of polynomial that fits the date points