I have a NonlinearModelFit in a very large program,
f1 = NonlinearModelFit[d1, a Exp[-(b (x - c1))^2] + yoff, {a, b}, x]
Which is used in my program to produce a nice Gaussian fit to a set of data. The issue being I need to find the FWHM, and the Fitted Model seems to reject having any of its fitted variables accessed from the outside.
So, as a work around, I tried to manually pull out the FWHM with
Dynamic[peakpos = FindMaximum[f1[x0], x0]]
Dynamic[FindRoot[
f1[x] == 0.5*peakpos[[1]], {x, (x0 /. peakpos[[2]]) + 0.05}]]
Dynamic[FindRoot[
f1[x] == 0.5*peakpos[[1]], {x, (x0 /. peakpos[[2]]) - 0.05}]]
However, this is also failing with a laundry list of errors, and I have no doubt I'm misunderstanding how this is supposed to work.
How can I drag the Full Width at Half-Maximum out of a Fitted Model?
f1["BestFitParameters"]
. $\endgroup$Dynamic
serves and suspect you've misunderstood how it works. I think it can just be omitted and also that leaving it in might cause trouble down the road. If it is just to avoid having to type shift-enter whenf1
changes, I still think that might cause trouble. $\endgroup$