Display the formula of a fitted model with its coefficient values

3 次查看(过去 30 天)
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?

采纳的回答

manuel FOSSA
manuel FOSSA 2016-9-7
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....])

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by