plotting all the points in x-y graph with the same time coordinate

415 views Asked by At

How do I mark or plot all the points in the x and y graph that have the same t-coordinate? I've gotten [t, P] with help of ode45 and ode20 start positions.The time is shown by t and P is the matrix that contains all the x- and y-coordinates which are our answers.

So I plotted the answer and I got several curves. Now I want to mark or plot all the points that have the same time.

How do I do that? Thanks in advance!

1

There are 1 answers

0
wandering star On

It sounds like you have several curves (x, y, t) and would like to choose a certain t = T, and plot all the (x, y) for t = T. I haven't used the ode functions in some time, but I assume you have N sets of {t, P} which I'll denote using t{i} and P{i}

If all your (x, y, t) curves are sampled at T, then you can do something like this

close all
for k = 1:N
    correctTimeIndex = find(t{k} == T);
    plot(P{k}(correctTimeIndex, :); % assuming two columns for x, y
    hold all
end

If your (x, y, t) curves are not sampled at the correct value of T, then you'll need to interpolate using interp1 to get the right values for x and y.