How to plot best fit line?
Show older comments
I have 1700 plot of data in graph. How do I plot the line of best fit? I stored the x and y data in table and the plot them. From the graph, I can see that the graph plotting is upwards. I have read other answers for this kind of question but still confused. Please help. Thank you.
x = score;
y = MOS;
scatter(x,y)
xlabel('score')
ylabel('MOS')
Accepted Answer
More Answers (1)
Jos (10584)
on 15 Jan 2018
if it is just for plotting, the command lsline would do.
x = 1:10 ; y = 2* x + 3 ;
plot(x, y, 'bo') ;
lsline
1 Comment
optoengineer2
on 9 Feb 2021
lsline works only with "Statistics and Machine Learning Toolbox"
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!