"Import gaussian.dat and ListPlot them"
SetDirectory[NotebookDirectory[]];rawdata=Import["gaussian.dat"];
lp=ListPlot[rawdata]

"Fit the data points against the formula a*Exp[-(x-b)^2] to find the best-fit values for a and b"
nlmf=NonlinearModelFit[rawdata,a*Exp[-(x-b)^2],
{{a,.5},{b,25}},x]
(*nlmf2=NonlinearModelFit[rawdata,{A*Exp[-B((x-mu)^2)]},{A,B,mu},x]*)

"Check the output of the curve fitting using 'BestFit' or 'Normal'"
nlmf["BestFit"]
Normal[nlmf]

"The best-fit parameters, a and b can be printed out via the command BestFitParamters"
nlmf["BestFitParameters"]

"How to abstract the numerical value of a and b in the output nlmf? Use the /. command as followed: "
a=a/.nlmf["BestFitParameters"];
b=b/.nlmf["BestFitParameters"];
Print["a = ",a]
Print["b = ",b]

"Check that indeed a = 1 and b = 1 are the best-fit parameters by plotting the curve a*Exp[-(x-b)^2] and overlap it on the original rawdata"
plt=Plot[a*Exp[-(x-b)^2],{x,0,50},PlotRange->All];
Show[plt,lp]

NonlinearModelFit[rawdata,{a*Exp[-(x-b)^2]},{{a,0.5},{b,28}},x]

({{"Let's fit the data against a more formal form of Gaussian function"
}, {nlmf2=NonlinearModelFit[rawdata,{(1.0/(sigma*Sqrt[2Pi]))*
Exp[-(1/(2*sigma^2))((x-mu)^2)]},{{sigma,5},{mu,28}},x]
}})

nlmf2["BestFit"]

nlmf2["BestFitParameters"]

sigma=sigma/.nlmf2["BestFitParameters"];
mu=mu/.nlmf2["BestFitParameters"];

"Check that indeed sigma->2.468171926242852`,mu->28.662478413375148` are the best-fit parameters by plotting the curve (1.0/(sigma*Sqrt[2Pi]))*
Exp[-(1/(2*sigma^2))((x-mu)^2)] and overlap it on the original rawdata"

plt2=Plot[(1.0/(sigma*Sqrt[2Pi]))*
Exp[-(1/(2*sigma^2))((x-mu)^2)],{x,0,50},PlotRange->All];
Show[{plt2,lp,plt}]

"Given a set of data you can always fit them against any formula you think is appropriate. For example, you think gaussian.dat looks like a gaussian distribution, so you would like to fit them againsts some functions that look like a bell shape. Both functions, 
(1.0/(sigma*Sqrt[2Pi]))*
Exp[-(1/(2*sigma^2))((x-mu)^2)] and a*Exp[-(x-b)^2 
are bell-shape functions, that are expressed slightly differently."

"Now, after the above exercise, which formula you think best  discribe the data? "

"One way is by comparing visually the resultant curves using the best-fit parameters against the original data, i.e, via Show[{plt2,lp,plt}] "
Show[{plt2,lp,plt}]