I have several functions f1(x),f2(x)...fn(x). Each function is made to fit a data set called v(i) Each one has this form for example : f1(x)=a1*x Now i would like to plot all of them by calling a for loop
plot for [i=i0:ie:di] v(i) using 1:($3)
So far so good. Now i would like to call a1,a2,a3..etc for each i, for example to rescale the data, and i would write it like this
plot for [i=i0:ie:di] v(i) using 1:($3/a(i))
where
a(i)=sprintf("a%01.0f",i)
The problem is to pass from a string to a float, and to gnuplot to recognize it as a defined parameter. I've tried to add zero to make the implicit cast but it doesn't work. Even if i print
print (a(i)+0)
Does someone has an idea to achieve getting my a(i) ?
Thanks you very much for any suggestion
Thanks you for the real function suggestion, but i still get the following problem, which can be seen as this minimal example
a1=12
a(x)=sprintf("a%01.0f",x)
print real(a(i)) #want to get 12 here
Non-numeric string found where a numeric expression was expected