fit data with a line
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
ok
1 Kommentar
Antworten (1)
Ameer Hamza
am 19 Jun. 2020
Try something like this
x = linspace(0, 1, 100);
y = 3*x + 2 + rand(size(x));
pf = polyfit(x, y, 1);
y_pred = polyval(pf, x);
r2 = rsquare(y, y_pred); % R-squared
sse = sum((y-y_pred).^2); % SSE
2 Kommentare
Ameer Hamza
am 19 Jun. 2020
Oh! I forgot to mention, rsquare is from this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/34492-r-square-the-coefficient-of-determination
Siehe auch
Kategorien
Mehr zu Fit Postprocessing 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!