problem regarding plotting cuvres

I am supposed to plot 3 curves on the same figure, The first plot is ok( the red one ), but the other 2 I am getting 2 separated curves for each plot..is there any idea to help me solve this problem?
Thanks in advance.

4 Comments

It seems the x-coordinates are not arranged in an increasing order.
how can i arrange them in an increasing order?
How are you calculating the positions? Are you possibly using roots() or solve() or vpasolve() ?
im just plotting 3 curves of a differential equation using 2 different approximation methods

Sign in to comment.

 Accepted Answer

Torsten
Torsten on 15 Apr 2022
Edited: Torsten on 15 Apr 2022
Insead of using
plot(x,y)
try
[sorted_x,I] = sort(x);
sorted_y = y(I);
plot(sorted_x,sorted_y)
for the green and blue curves.

More Answers (0)

Categories

Asked:

on 15 Apr 2022

Commented:

on 15 Apr 2022

Community Treasure Hunt

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

Start Hunting!