.Modelica.Math.Polynomials.fitting

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

Interface

function fitting
  extends Modelica.Icons.Function;
  input Real u[:] "Abscissa data values";
  input Real y[size(u, 1)] "Ordinate data values";
  input Integer n(min = 1) "Order of desired polynomial that fits the data points (u,y)";
  output Real p[n + 1] "Polynomial coefficients of polynomial that fits the date points";
end fitting;

Generated at 2024-11-21T19:25:40Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos