0
votes

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?

1

1 Answers

2
votes

The solution (since version 4.4):

plot for [i=1:100] 'output.dat' u (column(2+4*i)):(column(3+4*i))