Is there a C++ library that implement similarly as in function Fit designating specific bi-variable polynomial form and then find fit coefficients?

14 Ansichten (letzte 30 Tage)
Is there a C++ library that implement similarly as in function Fit designating specific bi-variable polynomial form and then find fit coefficients?
ie
g = fittype( @(a,b,c,x,y) a*x.^2+b*x.*y+c*y.^2 ), ...
'independent', {'x', 'y'}, ...
'dependent', 'z' );
Is there such a C++ library also able to desianate specific bi-variable polynomial form?(up to 20th polynomial) I find it rather slow when it comes to high order polynomial using matlab Fit and want to find some C++ libs to accelerate such process.
  1 Kommentar
Steven Lord
Steven Lord am 28 Aug. 2019
(up to 20th polynomial)
That smells a bit fishy. Does the underlying problem have some physical reason you expect the data to be fit well by such a high order polynomial or are you using up to a 20th order polynomial because you can? As Jeff Goldblum's character Ian Malcolm said in Jurassic Park, "Your scientists were so preoccupied with whether they could that they didn’t stop to think if they should."
What is the range of x and y data you're planning to pass into this fit object? Are you likely to encounter loss of significance when adding and subtracting multiples of x^20 and y^20?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Gaurav Garg
Gaurav Garg am 28 Aug. 2019
Hi,
I understand that you wish to know a C++ library that is faster than fittype function in MATLAB for higher order polynomial equations. You can use cmath library in C++, where you can create a coefficient matrix, perform gaussian elimination and then back-substitute the values to get the final answer.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by