Line of best fit not plotting correctly
Show older comments
Hi,
When I use the graph app to find a line of best fit to my data, everything seems to be working fine (see attached image).
But when I try to plot this line of best fit alongside the scatter data, the line is nowhere near. Does anyone know what might be going on?
figure
scatter(E5half41,logI5_41,5)
hold on
y=-0.1172.*E5half41+3.954;
plot(y,E5half41)
cheers!
Accepted Answer
More Answers (1)
William Rose
on 28 Feb 2022
0 votes
@Em, X and Y are flipped, for the best fit line plot, compared to what they should be.
Categories
Find more on Scatter Plots 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!