I often have datasets that contain a number of curves which can be fitted with a certain function, like a time series of decay curves or something.
It'd be nice if the fit command, like plot, could iterate through such a set, saving the fit results into arrays instead of single numerical variables.
At the moment I have to define the function twice, with arrays and single variables, and loop over the fit using the latter and copy the results into the former. Very cumbersome if you want to try out different formulas.
If something like this
f(x,i) = a[i] * exp(-x/b[i])
fit for [i=1:16] f(x,i) filen index i using 1:2 via a, b
plot for [i=1:16:3] f(x,i) lc i, for [i=1:16:3] fname index i using 1:2 lc i
would work, that'd save a lot of typing.
Isn't that the same as
saving about 1 or 2 lines of typing?
Maybe I missed something.
Is there a reason why not directly like this?
I was somehow convinced that doesn't work. Thanks for showing otherwise!