Automatically insert coefficients in surface fit

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.

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 23 日

1 投票

You can use fprintf()
fprintf('data(x,y) = %.4f + %.4f*x + %.4f*y\n', data.p00, data.p10, data.p01)

2 件のコメント

Thijs van den Heuvel
Thijs van den Heuvel 2020 年 11 月 24 日
Thank you!
Ameer Hamza
Ameer Hamza 2020 年 11 月 25 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by