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*

## Author: Jay Jay Billings

I'm a physicist with a serious addiction to computing. Most days you can find me bumming around ORNL and Twitter.
View all posts by Jay Jay Billings