I have the following data:

DataAZ400K = {{293, 1.98}, {313, 1.34}, {326, 1.58}, {344, 
    2.54}, {358, 3.8}, {373, 6.12}};

I want to fit this data with an exponential fit of the Arrhenius form $y \propto e^{-\frac{C}{k_{B}x}}$ where $k_B=1.38 \times 10^{-23}$ and $C$ is a fitting parameter. Ideally, I would also like to do the fitting in a $Log(y)$ v/s $1/x$ plot where the fitting should just be linear. How can I do the fitting in both linear plot and the second type $Log(y)$ v/s $1/x$.

  • $\begingroup$ Can you please help me with that in the log(y) vs 1/x plot? $\endgroup$ Nov 3, 2022 at 18:42
  • 1
    $\begingroup$ Please post the code you've tried with NonlinearModelFit and/or LinearModelFit along with a description of any trouble you're having. The documentation on those two functions should be useful. $\endgroup$
    – JimB
    Nov 3, 2022 at 21:08

1 Answer 1


NonlinearModelFit and LinearModelFit both work well. The one caveat is setting the scale of the parameters since the Boltzmann constant has such a small numerical value.

Alternatively, you can include kB in the fit by fitting to, e.g., A Exp[-Ck/x] with fit parameters A and Ck. A good initial guess for Ck is the typical size of your x values, i.e., around 300.

fit = NonlinearModelFit[DataAZ400K, A Exp[-Ck/x], {{A, 1}, {Ck, 300}},x]

This gives a fit with values for A and Ck. The C parameter in your fit equals Ck times kB. Compare fit and data:

Show[Plot[fit[x], {x, 290, 380}], ListPlot[fit["Data"]]]

nonlinear fit

For linear fit, convert your data to the form {1/x, Log[y]} e.g.,

linearData = {1/#[[1]], Log[#[[2]]]} & /@ DataAZ400K

and then a linear fit as a function of a variable x1 standing for 1/x:

fitLinear = LinearModelFit[linearData, x1, x1]

and plot:

Show[Plot[fitLinear[x1], {x1, 1/400, 1/290}], ListPlot[fitLinear["Data"]]]

linear fit

To display the original y coordinates with the linear fit, exponentiate and plot with log scale:

 Show[LogPlot[Exp@fitLinear[x1], {x1, 1/400, 1/290}], ListLogPlot[{#[[1]], Exp[#[[2]]]} & /@ fitLinear["Data"]]]

log scale for linear fit

  • $\begingroup$ In the Log (y) vs 1/x plot, how can I make the y axis to display the real y values but in the log scale? $\endgroup$ Nov 6, 2022 at 14:33
  • $\begingroup$ One way is exponentiate the y values and use Log plots. More generally, have a look at documentation for ScalingFunctions. $\endgroup$
    – tad
    Nov 6, 2022 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.