How to get the fitted data by using Matlab's "Fit" Function?
27 次查看(过去 30 天)
显示 更早的评论
For example, by using below code
load franke;
fitresult = fit( [x, y], z, 'poly33' );
From fitresult, I can get the formula used to fit x,y and z data
But how can I get the fitted data matrix via this "fit" function?
0 个评论
采纳的回答
Wayne King
2012-9-22
It gives you a 1-D vector, but that 1-D vector is a polynomial in two variables, hence it is a function of the form f(x,y)=z
Calling
formula(fitresult)
shows you exactly what the terms in x and y the coefficients multiply
0 个评论
更多回答(1 个)
Wayne King
2012-9-22
Hi, you can use the coeffvalues() method on the fitresult object.
coeffs = coeffvalues(fitresult);
That will give you the coefficients of your polynomial in x and y.
To see how those coefficients enter into the polynomial equation:
formula(fitresult)
2 个评论
grace
2013-2-22
May I know what is the code for goodness of fit? coeffs = coeffvalues(fitresult); Similarly, rsquare = code(fitresult); I wanted to get the rsquare values from cftool to display in command window.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!