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.

  • 2
    $\begingroup$ You should learn to format your code when asking Q, post self contained snippets and not use single capital letters in MMA. $\endgroup$
    – Ajasja
    Jan 30, 2014 at 20:37
  • $\begingroup$ Please provide a data example to work on. $\endgroup$
    – Kuba
    Jan 30, 2014 at 20:41

1 Answer 1

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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