How can I find the coeficients alpha, beta of the simple linear regression, using polyfit function?

4 vues (au cours des 30 derniers jours)
How can I find the coeficients alpha, beta for the X coordinates of the simple linear regression, using polyfit function?

Réponse acceptée

Torsten
Torsten le 10 Déc 2022
x = (0:0.1:1).';
y = 3*x + 4 + 0.01*randn(numel(x),1);
polyfit(x,y,1)
ans = 1×2
2.9778 4.0097

Plus de réponses (0)

Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by