#Set the name of the file for the graph
set term pdf
set out 'dampdatout.pdf'

#The lines below fit the data
a = 15.0
b = 0.02
T = 2.0
p = 0.01
f(x) = a*exp(-b*x)*cos(6.28319*x/T+p)
fit f(x) 'dampdat.txt' using 1:2 via a, b, T, p

#The lines below graph the data and the fit
set grid
set key at screen 0.95, 0.95
set xlabel 'Time(sec)'
set ylabel 'Amplitude'
set xrange [2:40]
plot 'dampdat.txt' u 1:2  with points pt 7 ps 0.3 t 'Data',\
f(x) t 'Fit'

