How to save and use the slope of fitted line in linear curve fitting as a variable in matlab?
1 次查看(过去 30 天)
显示 更早的评论
Hello How to save and use the slope of fitted line in linear curve fitting as a variable in matlab?
0 个评论
回答(1 个)
Star Strider
2017-11-10
If you are referring to the line produced by the lsline function, this works:
figure(1)
scatter(1:10, rand(1, 10))
hl = lsline;
B = [ones(size(hl.XData(:))), hl.XData(:)]\hl.YData(:);
Slope = B(2)
Intercept = B(1)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!