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

15 次查看(过去 30 天)
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 个评论
Steven Lord
Steven Lord 2019-8-28
(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?

请先登录,再进行评论。

回答(1 个)

Gaurav Garg
Gaurav Garg 2019-8-28
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.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by