How to use regression?
조회 수: 2 (최근 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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!