Data point in plot connecting randomly to each other

4 Ansichten (letzte 30 Tage)
Timothy Lim
Timothy Lim am 21 Jan. 2019
Kommentiert: Kevin Phung am 21 Jan. 2019
The pattern of the plot is obviously going up from 0-2 then all the way down, I do not know why are the points randomly connecting to a point further away and not connecting like it used to (by ascending order).
  4 Kommentare
madhan ravi
madhan ravi am 21 Jan. 2019
show your plot call
Timothy Lim
Timothy Lim am 21 Jan. 2019
plot(ratio_1,f1_1) - gives me the random connecting lines. Image in my question
plot(ratio_1,f1_1,'o') - gives me the circular data point. Image in my first reply.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kevin Phung
Kevin Phung am 21 Jan. 2019
I would sort the x values and sort the y values based on how the x values were sorted.
You can do this with
[sorted_array sorted_order] = sort(x);
y = y(sorted_order;)
  3 Kommentare
Timothy Lim
Timothy Lim am 21 Jan. 2019
I'll accept the answer in an hour if no one is able to give a more convenient way (no need for any sorting, direct plotting based off the array relationship).
Thanks for the answer mate.
Kevin Phung
Kevin Phung am 21 Jan. 2019
No problemo amigo

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by