Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help with plot

Subject: Help with plot

From: Iris

Date: 6 Dec, 2012 16:01:08

Message: 1 of 1

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?!...
Thank you in advance :)

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us