The form I'm using should be correct because when I input my initial guesses it plots a shape similar to my data. When I use NonlinearModelFit, the fit is not correct at all and is almost flat, then curves at the end.
ClearAll[compton, \[Beta], l, e1, ec, e2, peakresponse, comptonresponse, response, e0]
listdata =
Import["B:\\PHY353L\\RelativisticDynamics\\NA22 day22.Spe",
"Table"];
databeta = Transpose[{Range[501], listdata[[2500 ;; 3000, 1]]}];
databetaplot = ListPlot[databeta]
peakresponse[\[Beta]_, e1_, e2_] := (Abs[\[Beta]*e2*\[Pi]])^(-1/2) *
Exp[(-(e1 - e2)^2/(2*\[Beta] * e2))]
nlmbeta =
NonlinearModelFit[databeta,
peakresponse[\[Beta], e1, e2], {{\[Beta], 80}, {e2, 100}}, e1,
MaxIterations -> Infinity];
nlmbeta
Print[nlmbeta["ParameterTable"]]
betaplot = Plot[nlmbeta[e1], {e1, 0, 500}, PlotRange -> All]
Show[databetaplot, betaplot]
Plot[peakresponse[130, e1, 100], {e1, 0, 500}]
Plot of my data
Data + the bad fit
Form of the fit
In this google drive link are my notebook and data. https://drive.google.com/open?id=1YVKG7ZhNp3jBhbGDLHdBu-mR7iq0Z91N
I am out of options to try.
peakresponse[130, e1, 100]
. $\endgroup$