Good Morning, I have a set of experimental data which i want to fit with a formula that I know it works. I tried to write a code in mathematica notebook that I put it here
data = {{1.45045*10^8, 1.}, {7.44768*10^8, 0.8787}, {1.81148*10^9,0.7013}, {3.34183*10^9, 0.5414}, {5.33711*10^9,0.3959}, {7.80159*10^9, 0.2703}, {1.07275*10^10,0.1857}, {1.41183*10^10, 0.1399}, {1.79806*10^10,0.1022}, {2.2302*10^10, 0.07084}, {2.70884*10^10,0.04772}, {3.23398*10^10,0.03562}, {3.80655*10^10,0.02567}, {4.42474*10^10, 0.01419}, {5.08944*10^10,0.01431}, {5.80178*10^10, 0.01108}};
model = 1/(1 + σ^2/DD*b)^(DD/σ)^2;
nml = NonlinearModelFit[data, model, {DD, σ}, b]
Show[
Plot[nlm[b], {b, 0, 10^11}],
ListPlot[data, PlotStyle -> {Darker@Green, PointSize[0.03]}]
]
It gives some errors. I want to show the superposition of original data and the fitting function on semiLog (in the ordinate axis). Can you help me Please? Thank you. Have a nice day.
nml = NonlinearModelFit[data, {model, σ > 0, DD > 0}, {DD, σ}, b]
. You can get the parameters withnml["ParameterTable"]
. Also watch out, you are plottingnlm[b]
notnml[b]
- must be a typo? $\endgroup$data[[All, 1]] = data[[All, 1]]/10^10
and you'll get a near perfect fit with no need for constraints. $\endgroup$model = 1/(1 + \[Sigma]^2/DD*(b/10^10))^(DD/\[Sigma])^2;
, then the fit will also work with no problems. $\endgroup$