How to fit custom polynomial equation?

10 Ansichten (letzte 30 Tage)
Vick
Vick am 26 Mär. 2020
Bearbeitet: John D'Errico am 26 Mär. 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?

Akzeptierte Antwort

John D'Errico
John D'Errico am 26 Mär. 2020
Bearbeitet: John D'Errico am 26 Mär. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by