Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two separated matrices in the form

 X[[i*dx,j*dt]] and V[[i*dx,j*dt]] 

where i & j are integers from (1 to N) & (1 to M). V & X are velocity and space respectively in phase space.

I want to figure out a two dimensional (V-X) plot of these two matrices for different values of time (which is j*dt) in a sequence manner. I can use the following command to plot it for an specific time (e.g. j*dt=5) for all space:

ListPlot[Table[{V[[i,5]], X[[i,5]]}, {i, 1, N}];  

But I'm in trouble to show it in sequence . I tried "Manipulate" command:

Manipulate[ListPlot[Table[{V[[i, j]], X[[i, j]]}, {i, 1, N}]], {j, 1, M}];

But unfortunately it doesn't work. Just notice that I need 2-D figure that represent a (V-X) plot of all space for different times. I don't know what should I do.

share|improve this question
You should learn to format your code when asking Q, post self contained snippets and not use single capital letters in MMA. – Ajasja Jan 30 '14 at 20:37
Please provide a data example to work on. – Kuba Jan 30 '14 at 20:41
up vote 2 down vote accepted
n = 20; m = 500;
x = RandomReal[{0, 30}, {m, n}];
v = Table[RandomReal[{0, k}], {m}, {k, n}]; 
Manipulate[ListPlot[Table[{v[[i, j]], x[[i, j]]}, {i, 1, m}], 
           PlotRange -> {{0, n}, {0, 30}}], {j, 1, n, 1}]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.