Display the formula of a fitted model with its coefficient values

2 vues (au cours des 30 derniers jours)
I have an sfit model from a 5 degrees polynomial fit of a surface.
The formula for the object is of the form:
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 + p03*y^3 + p40*x^4 + p31*x^3*y
+ p22*x^2*y^2 + p13*x*y^3 + p04*y^4 + p50*x^5 + p41*x^4*y
+ p32*x^3*y^2 + p23*x^2*y^3 + p14*x*y^4 + p05*y^5
I would just like to display (as a character string) the formula but with its coefficients values instead of their names (that is 19.33 instead of p00, and so on..). In the sfit methods i only found methods to either display the formula in literal form or the coefficients values but not both at the same time.
Is there any possibility to do so?

Réponse acceptée

manuel FOSSA
manuel FOSSA le 7 Sep 2016
Found the solution which is of the form
formula_fitted=formula(fittedmodel)
paste and copy the formula then
disp([num2str(fittedmodel.p00) '+' num2str(fittedmodel.p10) '*x' '+' num2str....])

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by