# To fit a curve , the plot is in LogLinearPlot. I am trying to fit an equation for this curve

ks = {0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600,
800, 1*^3, 2*^3, 4*^3, 5*^3, 10*^3, 15*^3, 20*^3, 30*^3, 40*^3,
70*^3, 1*^5, 1*^6, 1*^8, 1*^12};
aa={15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.708,15.9633,17.5533,18.8007,18.9791,18.9791,18.9791}
ListLogLinearPlot[Table[{ks[[i]], aa[[i]]}, {i, 30}], Joined -> True,
PlotRange -> All]


Above are the data I am having, but the problem is my x-axis is in logarithmic scale and my y-axis is in linear scale. Now I have to fit an equation which mimic this curve. I checked NonLinearMoedlFit, But I did not understand it properly. How to extract the equation using the nonlinear model fit function?

• Table[{ks[[i]], aa[[i]]}, {i, 30}] can be simplified to Transpose[{ks, aa}] or Thread[{ks, aa}] – Bob Hanlon Oct 11 '18 at 17:11

Very large dynamic ranges with many points crowded together at one end and vast spaces between points at the other end seem to often confuse fit routines. So let's work with the log of your horizontal axis to get the fit and then you can transform that back to your original range afterwards if you really need to.

lst = N[Table[{Log10[ks[[i]]], aa[[i]]}, {i, 30}]];
model = a E^(b (x - c))/(E^(b (x - c)) + 1) + d;
ff = FindFit[lst, model, {a, b, c, d}, x];
Show[ListPlot[lst],Plot[model/.ff, {x,-2,12}], PlotRange->All]


Doesn't look like a bad fit and it didn't need any fiddling or conditions on the variables to get that to work.

18.9969-(3.28698 E^(-13.5137(-4.82318+x)))/(1+E^(-13.5137(-4.82318+x)))

• You could try fitting a line to the three points that lie on the sharply increasing part of your data. ks = {30*^3, 40*^3, 70*^3}; aa = {15.9633, 17.5533, 18.8007}; lst = N[Table[{Log10[ ks[[i]]], aa[[i]]}, {i, 3}]]; model = m*x + b; ff = FindFit[lst, model, {m, b}, x]; Show[ListPlot[lst], Plot[model /. ff, {x, Log10[30*^3], Log10[70*^3]}], PlotRange -> All] – Bill Oct 12 '18 at 20:13