How to use regression?
1 次查看(过去 30 天)
显示 更早的评论
I have 2 vectors and i want to obtain a correlation between them like y=ax+b by using regression, but i don't know how to use this code. would anyone help me with this?
0 个评论
采纳的回答
Walter Roberson
2017-3-12
coeffs = polyfit(FirstVector, SecondVector, 1);
Then coeffs(1) will be your a, and coeffs(2) will be your b.
4 个评论
Walter Roberson
2017-3-12
Note that when I say "a different way of writing the same thing", I mean that polyfit() really does construct those matrices and use the \ operator.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!