fit [<range specifier> ...] <function> '<datafile>' [index <index specifier>] [using <using specifier>] via <variable>[, <variable>, ...]
The fit command may be used to fit functional forms to data in files. A simple example might be:
f(x) = a*x+b fit f(x) 'data.dat' index 1 using 2:3 via a,b
The coefficients to be varied are listed after the via keyword; the modifiers index, every and using have the same meanings as in the plot command.
This is useful for producing best-fit lines and also has applications in estimating the gradients of datasets. The syntax is essentially identical to that used by Gnuplot, though a few points, outlined in Section 2.11, are worth noting.