Fitting data to a function with Gnuplot

Put your x,y data in a file that Gnuplot can read, like a simple text file with an x,y pair on a line separated by a space.

Define the function, for example:


Do the fit:

fit gauss(x) ‘gaussTest.dat’ via a, sigma, p

Plot the output with the data:

plot ‘gaussTest.dat’ with histeps, gauss(x)