WOLFRAM SYSTEM MODELER

fitting

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

Wolfram Language

In[1]:=
SystemModel["Modelica.Media.Incompressible.TableBased.Polynomials_Temp.fitting"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

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];

Syntax

p = fitting(u, y, n)

Inputs (3)

u

Type: Real[:]

Description: Abscissa data values

y

Type: Real[size(u, 1)]

Description: Ordinate data values

n

Type: Integer

Description: Order of desired polynomial that fits the data points (u,y)

Outputs (1)

p

Type: Real[n + 1]

Description: Polynomial coefficients of polynomial that fits the date points