I have a gnuplot script to plot 100 data files of (x,y)
format. Now I would like to do a linear y=m*x + b
fit of each set of data and get the corresponding m,b
values for each set of data. The script crashes when it gets to the eval command. Since the do for syntax is not supported in gnuplot 4.4 (which I am using), can anyone tell me how to use eval correctly in the for loop? My script is as follows:
# template.gnuplot
set terminal postscript enh color 24
plotfile = "graph.eps"
set output plotfile
filename(n) = sprintf("%d_mod.int", n)
plot for [i = 1:100] filename(i) u 1:2 title sprintf("%d", i) w lp
fstr(n) = sprintf('f%d(x) = m%d*x + b%d', n)
fitstr(n) = sprintf('fit ''%d_mod.int'' f%d(x) via m%d,b%d', n)
eval fstr(i) for [i = 1:100]
eval fitstr(i) for [i = 1:100]