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:

gauss(x)=a/(sigma*sqrt(2.*pi))*exp(-(x-p)**2./(2.*sigma**2))

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)

### Like this:

Like Loading...

*Related*