Linear approximation that goes through zero
显示 更早的评论
Hello, I have a few points, and I need to approximate them with linear function that goes through zero. Any ideas?) Thank you in advance)
3 个评论
Mathieu NOE
2022-2-7
HI
have you tried with 1st order polynomial (using polyfit) ?
@Mathieu NOE I was going to suggest the way Matt did it
x=0:5 + 3;
y = 1.5 * x + randn(size(x)) * 0.4 + 10;
slope = x(:) \ y(:);
yFitted = slope * x;
plot(x,y,'.',x,yFitted, 'MarkerSize', 20);
grid on;
Is there a way to get the offset to be zero with polyfit()?
Mathieu NOE
2022-2-7
seems the topic has been already debated quite often
solutions from FEX :
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

