Function for least squares approximation (fitting) data with polynomial-type function (C/C++ codes).
by
Leonid Sakharov
Operation of approximation experimental data (in most broad sense they could be product not only direct measurements but also numbers from computer simulation process) is one of the standard method in data modeling. Here you will be able to find C codes for implementation these methods into your software. There are two version of functions – first is most convenient in VC environment were CArray class is supported. Second is more traditional with passing arrays of data via standard pointers. Both versions contain also functions for matrix inversion these are necessary for implementation.
/*Version 1 – most useful for usage in Visual C environment. It has following arguments two pointer to arrays of fitting experimental data, dimension of fitting polynomial function, pointer on resulting array that contains values of fitting coefficients. Version 2 – is more traditional C codes where arrays is passed as pointers to array that will contains pointers to experimental data, integer of dimension of fitting polynomial function.
*/