plot scattered data in order (matlab) -
i have scattered data want plot. line of plot not following trend of scattered data.
a=[1.3476 0.7015 0.2449 0.3402]; b=[0.1 0.2 0.3 0.3]; plot(a,b) figure scatter(a,b,'marker','x') a , b vectors contain small number of data points have.
as seen, line in plot(a,b) not following right order.
i need line passes through points left right appear in figure when use scatter command.
thanks!
if understand correctly: sort a , apply same sorting b:
[sa, ia] = sort(a); sb = b(ia); plot(sa,sb)
Comments
Post a Comment