How to calculate r squared from a given cos regression model
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi i am a new learner, i got confused how can i calculate like this,
if there's two sets,
x = [0.0000 0.5236 1.0472 1.5708 2.0944 2.6180 3.1416]
y = [2.7600 -2.3902 1.3800 0.0000 -1.3800 2.3902 -2.7600]
and the given function, y = a ∗ cos(5x), find the r squared for this function
0 Kommentare
Akzeptierte Antwort
Rik
am 16 Mär. 2020
y_fit = a ∗ cos(5*x)
err=y-y_fit;
SSres=sum(err.^2);
SStot=sum((y-mean(y)).^2);
rsq=1-(SSres./SStot);
5 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!