0

I have a program that outputs the position of each particle from a many particle system. The output data is such that each row is a subsequent time step, and the columns have the position (and velocity)

Eg.

    t=1 x1 y1 vx1 vy1 x2 y2 vx2 vy2 ...etc
    t=2 x1 y1 vx1 vy1 x2 y2 vx2 vy2 ...etc
    ...etc

When I had a few particles I could plot each trajectory using commands of the following form

    plot "output.dat" u 2:3 w lines, "output.txt" u 6:7 w lines, ...etc

However, I now have almost 100 particles. How can I set up a script to plot the trajectory of each particle, knowing that the column for xi is 2+4*i and yi is 3+4*i?

0

1 Answer 1

2

The solution (since version 4.4):

plot for [i=1:100] 'output.dat' u (column(2+4*i)):(column(3+4*i))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.