Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Help with plot
Replies: 0

 Iris Posts: 8 Registered: 11/27/12
Help with plot
Posted: Dec 6, 2012 11:01 AM

Hello guys! :)
I have a matrix of values to plot, of dimensions (1:i_t,3*N). This represents, for N particles, the x, y and z coordinates, and as for the lines, is their position thought time, like this:

x1(t=0) y1(t=0) z1(t=0) x2(t=0) y2(t=0) z2(t=0) x3(t=0) y3(t=0) z3(t=0) .....
x1(t=1) y1(t=1) z1(t=1) x2(t=1) y2(t=1) z2(t=1) x3(t=1) y3(t=1) z3(t=1) .....
x1(t=2) y1(t=2) z1(t=2) x2(t=2) y2(t=2) z2(t=2) x3(t=2) y3(t=2) z3(t=2) .....
.......... ........... ........... ........... ........... ........... ........... ........... .......... .....

I have a routine to plot this that is:

for i = 1:N

X = Ra(:,(3*i-2));
Y = Ra(:,(3*i-1));
Z = Ra(:,3*i);
scatter3(Ra(1,(3*i-2)), Ra(1,(3*i-1)), Ra(1,(3*i)), 'k')
plot3(X, Y, Z, ':k')
scatter3(Ra(i_t,(3*i-2)), Ra(i_t,(3*i-1)), Ra(i_t,(3*i)), 'k')

view(3)
grid on
xlabel('x')
ylabel('y')
zlabel('z')

end

but the problem is that i need to do a movie of it, and this way it plots the values of the first particle for all times, then the values of the second particle for all times, and so on... what i need to do is, for the specific time, plot all the particles, can you help me with this please?!...