Iterating over powers of two in gnuplot
I want to plot data stored in a bunch of files using gnuplot. If the files were named using sequential numbers (eg "1.dat" "2.dat", ...) I would use something like
plot for [i=1:10] i.'.dat' u 1:2 w lp t 'I='.i;
However, now the files are named using authority 2, ie "2.dat", "4.dat", "8.dat", .... I tried
plot for [i=1:10] (2**i).'.dat' u 1:2 w lp t 'I='.(2**i);
but i am getting error
STRING operator applied to non-STRING type
I'm guessing this is happening because gnuplot counts (2**i)
as floating point, not integer.
I am sure there is a way to do what I want to do, but since I am very new to using gnuplot control statements, I cannot figure out how to do this. Can someone please help me?
+3
source to share
2 answers