.BuildSysPro.Utilities.Math.LeastSquares

Information

Hypothesis and equations

Given a cloud of N points (xi, yi), the best degree polynomial q which minimizes .

Finding the polynomial P means finding the vector which minimizes the norm avec and y the vector {yi}i=1,N.

Bibliography

none

Instructions for use

Example with Excel : we seek a polynomial trend curve of degree 3 with the following cloud of points :

Known limits / Use precautions

none

Validations

Validated function - Hassan Bouia, Sila Filfli 02/2011

--------------------------------------------------------------
Licensed by EDF under a 3-clause BSD-license
Copyright © EDF 2009 - 2023
BuildSysPro version 3.6.0
Author : Hassan BOUIA, Sila FILFLI, EDF (2011)
--------------------------------------------------------------

Interface

function LeastSquares
  input Integer N = 6 "Number of points";
  input Integer q = 3 "Degree of the sought polynomial";
  input Real x[N] = {1., 2, 3, 4, 5, 7} "X-axis";
  input Real y[N] = {1, 2, 3.2, 4, 4.5, 7.2} "Y-axis";
  output Real c[q + 1] "Coefficients of the sought polynomial";
end LeastSquares;

Revisions

Benoît Charrier 01/2016 : Adaptation pour compatibilité avec OpenModelica


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