# Example of plotting data and fitting data to an arbitrary # function in gnuplot # # The file gamma.dat contains the following points # 0.0 0.00 # 0.2 1.77 # 0.4 4.80 # 0.6 13.06 # 0.8 34.49 # 1.0 100.00 # # The next command plots the data points # plot "gamma.dat" with points # # Now define the arbitrary function to which we want to fit the data # F(x)=a*exp(b*x) # # Define a tolerance for the fit # FIT_LIMIT = 1e-12 # # Now attempt to fit the data to the funtion # fit F(x) "gamma.dat" using 1:2 via a,b # # The above command should return the fit values for a and b. # To place the fit line on your plot do the following... # replot F(x) with lines # # This should leave you with a nice plot on the screen. To get this # into a postscript form for plotting or turn in use the following # sets of command. set output "plot.ps" set terminal postscript enhanced color landscape replot # This should leave a file called plot.ps in your directory for printing # or inclusion into a paper.