
How can I connect the dots in my plot?
9 views (last 30 days)
Show older comments
Dustin Braun
on 27 Aug 2016
Commented: Star Strider
on 27 Aug 2016
Basically if I plot it 'x' it looks fine but if I plot '--' the lines connect in crazy pattern. What can I do?


Its really annoying me. I know that I can sort the data to match up with the correct points but to be honest I'm not sure how to do that.
please find attached source files and data,
0 Comments
Accepted Answer
Star Strider
on 27 Aug 2016
Another approach:
D = load('Dustin Braun PL0Data (6).mat');
x = D.x;
y = D.y;
A = [x.^3 ones(size(x))];
p = A\y;
x1 = linspace(min(x), max(x))';
y1 = [x1.^3 ones(size(x1))]*p;
figure(1)
plot(x, y, 'o', x1, y1, '-r')
grid

More Answers (1)
See Also
Categories
Find more on 2-D and 3-D 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!