How can I find the coeficients alpha, beta of the simple linear regression, using "\" operator
1 次查看(过去 30 天)
显示 更早的评论
How can I find the coeficients alpha, beta for the X coordinates of the simple linear regression, using "\" operator?
0 个评论
回答(1 个)
Torsten
2022-12-10
x = (0:0.1:1).';
y = 3*x + 4 + 0.01*randn(numel(x),1);
A = [x,ones(size(x))];
b = y;
coeffs = A\b;
coeffs(1)
coeffs(2)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!