How to use regression?

1 回表示 (過去 30 日間)
Ghazal Hnr
Ghazal Hnr 2017 年 3 月 12 日
コメント済み: Walter Roberson 2017 年 3 月 12 日
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?

採用された回答

Walter Roberson
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 件のコメント
Ghazal Hnr
Ghazal Hnr 2017 年 3 月 12 日
thank you very much
Walter Roberson
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 ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by