Automatically insert coefficients in surface fit

1 view (last 30 days)
When I fit a surface to data points, the output is something like this.
data(x,y) = p00 + p10*x + p01*y
Coefficients (with 95% confidence bounds):
p00 = 0.004555 (0.004179, 0.004931)
p10 = -0.0002772 (-0.0003244, -0.00023)
p01 = 2.366 (-0.3953, 5.128)
But because I need to to use this function very often, manually inserting the coefficients in the right place is getting tedious and time-consuming.
Is there any way for matlab to do this automatically? Giving me an output like
data(x,y) = 0.004555 - 0.0002772*x + 2.366*y
(I exclusively use polynomials, so don't worry about the other fitting methods.)
Thank you.

Accepted Answer

Ameer Hamza
Ameer Hamza on 23 Nov 2020
You can use fprintf()
fprintf('data(x,y) = %.4f + %.4f*x + %.4f*y\n', data.p00, data.p10, data.p01)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!