【发布时间】:2014-03-05 17:14:27
【问题描述】:
我正在使用 mathowrks 示例计算多项式拟合:
load census
figure
plot(cdate,pop,'ro')
corrcoef(cdate,pop)
figure
% Calculate fit parameters
[p,ErrorEst] = polyfit(cdate,pop,2);
% Evaluate the fit
pop_fit = polyval(p,cdate,ErrorEst);
% Plot the data and the fit
plot(cdate,pop_fit,'-',cdate,pop,'+');
% Annotate the plot
legend('Polynomial Model','Data','Location','NorthWest');
xlabel('Census Year');
ylabel('Population (millions)');
如何找到这种拟合的相关性?通过一个简单的线性关系,我可以使用 corrcoef 计算拟合,但在 mathworks 网站上,他们只提到“他下图显示二次多项式拟合提供了对数据的良好近似”,但没有进入任何统计数据。
谁能推荐一个方法?
http://www.mathworks.co.uk/help/matlab/data_analysis/programmatic-fitting.html
【问题讨论】:
-
计算root mean square error?
sqrt(mean((pop-pop_fit).^2))或者标准化版本可能会更好:sqrt(mean((1-pop_fit./pop).^2))
标签: matlab correlation