# 3D Matlab plot

1. Aug 11, 2009

### Weezix

Hi All

I am creating a 3D plot in matlab using the plot3 command. The 3 variables are time (a tx1 vector), X and V (both txn).

When plotting, matlab pairs the x and v points on the first row, pairs them up and plots, doing this for every row and connecting through time (i.e. matlab draws a line through time for every point (x_i,v_i))

However I would like it to join the x and v points together, like what would happen if you just plotted (x,v), and not connected through time, and dont know how this can be done, any ideas?

I hope you guys get what I mean, its not the easiest thing to describe!

Thanks

2. Aug 11, 2009

### KLoux

I'm not sure I understand what you want, but maybe it's something like this:
Code (Text):

hold on;
for i=1:1:size(x,2)
plot3(t,x(:,i),v(:,i));
end

-Kerry

3. Aug 11, 2009

### Weezix

Not quite...

Ok so say the first row of x and v are [x1,x2.....xN] and [v1,v2.....vN] respectively. What matlab does is at t=0 plot x against v but only as points, not as a curve. At t=1, it plots the second row, again as points, but now joins (x1,v1) from row one, with the (x1,v1) from row two.

What I would like is for at t=0, plot x against v as a curve, and not join between the rows...hope this is more clearer...

4. Aug 11, 2009

### KLoux

Code (Text):

hold on;
for i=1:1:size(t)
plot3(t(i) * ones(size(x,2)), x(i,:), v(i,:));
end

Getting warmer?

-Kerry

5. Aug 12, 2009

### Weezix

Thats more like it! Brilliant, thanks