Filter löschen
Filter löschen

How to use regression?

2 Ansichten (letzte 30 Tage)
Ghazal Hnr
Ghazal Hnr am 12 Mär. 2017
Kommentiert: Walter Roberson am 12 Mär. 2017
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 12 Mär. 2017
coeffs = polyfit(FirstVector, SecondVector, 1);
Then coeffs(1) will be your a, and coeffs(2) will be your b.
  4 Kommentare
Ghazal Hnr
Ghazal Hnr am 12 Mär. 2017
thank you very much
Walter Roberson
Walter Roberson am 12 Mär. 2017
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by