p = Polynomial.fitting(x, y, order);
This function computes a Polynomial y = p(x) of degree "order" that fits the data p(xi) - yi for i = 1, .. nx in a least squares sense.
encapsulated function fitting import Modelica; import Modelica_LinearSystems2.Math.Polynomial; input Real x[:] "Abscissa data values"; input Real y[size(x, 1)] "Ordinate data values"; input Integer order(min = 1) "Order of desired polynomial that fits the data points (x,y)"; output Polynomial p(redeclare Real c[order + 1]) "Polynomial that fits the date points in a least squares sense"; end fitting;