How to fit custom polynomial equation?

7 visualizzazioni (ultimi 30 giorni)
Vick
Vick il 26 Mar 2020
Modificato: John D'Errico il 26 Mar 2020
Following is the poly32 model,
equation(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 +
p21*x^2*y + p12*x*y^2
In the above equation i dont want p12*x*y^2 during my curve fitting(i.e. p12 should be zero). How can i achieve it?

Risposta accettata

John D'Errico
John D'Errico il 26 Mar 2020
Modificato: John D'Errico il 26 Mar 2020
You could download polyfitn from the file exchange.
But if you already know how to use the curve fitting toolbox, then just specify a custom equation of the desired form. Something like this:
modelform = fittype('p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 + p21*x^2*y',...
'coeff',{'p00','p10','p01','p20','p11','p02','p30','p21'},...
'indep',{'x','y'},'depend','z');
It will be treated as a nonlinear model internally as a function of the parameters, but since all of the coefficients actually do enter linearly, they will be easy to fit. fit should have no problems.

Più risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by