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
| Type | Name | Default | Description |
|---|---|---|---|
| Real[:] | u | Abscissa data values | |
| Real[size(u, 1)] | y | Ordinate data values | |
| Integer | n | Order of desired polynomial that fits the data points (u,y) |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[n + 1] | p | Polynomial coefficients of polynomial that fits the date points |