引用:
作者: shiqiang
最近发现求助曲线拟合的比较多,我就自己写了一个方便大家使用的最小二乘法曲线拟合的程序,这样需要的人可以直接下载使用了,所以以后类似的关于曲线拟合的大家不要再重复的发了。
|
你好,感谢你上传程序,但是我计算一道例题时遇到了问题
x=[1 -1 -1 -1;1 -1 -1 1;1 -1 1 -1;1 -1 1 1;1 1 -1 -1;1 1 -1 1;1 1 1 -1;1 1 1 1]
y=[7.6;10.3;9.2;10.2;8.4;11.1;9.8;12.6]
我用b=regress(y,x)可以算出b。但是用你的程序提示有错误。
??? Error using ==> polyfit at 48
X and Y vectors must be the same size.
Error in ==> polytool>dofit at 394
[stats.beta, stats.structure] = polyfit(x,y,degree);
Error in ==> polytool at 174
stats = dofit(x,y,degree,stats,0);
Error in ==> ff at 54
polytool(x,y,1)
我是初学者,谢谢指教