[問題]Curve fitting 輸出誤差
想要請教一下
我在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://www.ptt.cc/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
推
04/15 15:07, , 1F
04/15 15:07, 1F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章