作者chiangburger (汉堡)
看板MATLAB
标题[问题]Curve fitting 输出误差
时间Mon Apr 13 15:40:57 2015
想要请教一下
我在fit出斜直线後,想要输出最後的误差值
请问要怎麽输出呢
Code如下:
function [estimates, model] = fit_Line(x,y)
start_point = 1;
model = @linfun;
estimates = fminsearch(model, start_point);
function [sse, FittedCurve] = linfun(params)
m = params(1);
fit_Line = m*x;
FittedCurve = fit_Line;
ErrorVector = (FittedCurve - y);
sse = sum(ErrorVector.^2);
end
end
目前只知道从fminsearch下手 找出最小的sse并将它输出,但不知道实际上要怎麽操作
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.115.31.38
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MATLAB/M.1428910864.A.1FF.html
※ 编辑: chiangburger (140.115.31.38), 04/13/2015 15:44:13
※ 编辑: chiangburger (140.115.31.38), 04/13/2015 16:05:22
1F:推 tn00364361: 试着改用least square做? 04/15 15:07