I am having some troubles with the NonlinearModelFit function. However hard I try, I cannot get a nice fit curve for the data points. I know the parameter "a" is about 15*10^-6 but even if I plug in the guess parameter I still do not get the fitting. Do you have any suggestions?
Thanks a lot!
f[z_] := a*Sqrt[1 + (z)^2/(a^2*Pi/632.8/10^-9)^2];
data = {{0, 8*10^-6}, {2*10^-2, 23*10^-6}, {3*10^-2,
53*10^-6}, {-3.4*10^-2, 73*10^-6}, {-2*10^-2, 45*10^-6}};
nlm = NonlinearModelFit[data, f[z], {a}, z];
Show[ListPlot[data], Plot[{nlm[z]}, {z, -4*10^-2, 4*10^-2}],Frame -> True, Axes -> False, PlotRange -> Automatic]
NonlinearModelFit[]
? I do not see it in the code you provided. $\endgroup$f[z]
with your suggested initial condition ofa=15*10^(-6)
it does not resemble at all the few data points you provide. Do you maybe have a typo in your definition off
? Also: Slightly more data points might improve the fit (this is a general remark) $\endgroup$