Arrhenius type fit without taking the log(y) and inverse of x

Hi all, I have a group of data.
x= 0 7.2 12 16.7 19.4 20.8 21.5
y= 0.02526 0.02604 0.02678 0.02752 0.02822 0.02913 0.02963
And I want to fit the data using a arrhenius type fit with x as the x axis instead of log(x), please tell me how to solve this, thank you.

5 Kommentare

Try out this:
% Define the Arrhenius function
arrhenius = @(A, Ea, R, x) A .* exp(-Ea ./ (R .* x));
% Data
x = [0, 7.2, 12, 16.7, 19.4, 20.8, 21.5];
y = [0.02526, 0.02604, 0.02678, 0.02752, 0.02822, 0.02913, 0.02963];
% Gas constant in J/(mol*K)
R = 8.314;
% Initial guess for A and Ea
A0 = 1;
Ea0 = 1;
% Fit the data
f = fit(x', y', fittype(@(A, Ea, x) arrhenius(A, Ea, R, x)), 'StartPoint', [A0, Ea0]);
% Print the optimal parameters
fprintf('A = %.5f, Ea = %.5f\n', f.A, f.Ea);
A = 0.03044, Ea = 10.31241
John D'Errico
John D'Errico am 6 Apr. 2024
Bearbeitet: John D'Errico am 6 Apr. 2024
@Manikanta Aditya - your choice of course, but your comment surely should have been an answer, since it solves the question directly as asked. Then you would get credit for the answer. It could then get the upvotes it deserves.
@John D'Errico, Sure will post as answer, Thanks.
Note that your x-values have to be specified in [K], not in [degC] !!!
Thank you!

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Hi,
Check this to get answer to your query:
% Define the Arrhenius function
arrhenius = @(A, Ea, R, x) A .* exp(-Ea ./ (R .* x));
% Data
x = [0, 7.2, 12, 16.7, 19.4, 20.8, 21.5];
y = [0.02526, 0.02604, 0.02678, 0.02752, 0.02822, 0.02913, 0.02963];
% Gas constant in J/(mol*K)
R = 8.314;
% Initial guess for A and Ea
A0 = 1;
Ea0 = 1;
% Fit the data
f = fit(x', y', fittype(@(A, Ea, x) arrhenius(A, Ea, R, x)), 'StartPoint', [A0, Ea0]);
% Print the optimal parameters
fprintf('A = %.5f, Ea = %.5f\n', f.A, f.Ea);
A = 0.03044, Ea = 10.31241
Thank you.

6 Kommentare

Thank you!
Is it possible to draw the curve using Matlab?
% Define the Arrhenius function
arrhenius = @(A, Ea, R, x) A .* exp(-Ea ./ (R .* x));
% Data
x = [0, 7.2, 12, 16.7, 19.4, 20.8, 21.5];
x = x + 273.15;
y = [0.02526, 0.02604, 0.02678, 0.02752, 0.02822, 0.02913, 0.02963];
% Gas constant in J/(mol*K)
R = 8.314;
%Compute initial guesses for A and Ea solving log(y) = log(A) - Ea/R * 1/x
xt = 1./x;
yt = log(y);
A = [ones(numel(x),1),xt.'];
b = yt.';
sol = A\b;
% Set initial guess for A and Ea
A0 = exp(sol(1))
A0 = 0.1965
Ea0 = -R*sol(2)
Ea0 = 4.6930e+03
% Fit the data
f = fit(x', y', fittype(@(A, Ea, x) arrhenius(A, Ea, R, x)), 'StartPoint', [A0, Ea0]);
% Print the optimal parameters
fprintf('A = %.5f, Ea = %.5f\n', f.A, f.Ea);
A = 0.19735, Ea = 4702.95547
hold on
plot(x,y,'o')
plot(x,arrhenius(A0,Ea0,R,x),'g')
plot(x,arrhenius(f.A,f.Ea,R,x),'r')
hold off
That works, thank you.
I also wanted to fit the same data with Arrhenius function + a linear function, could you please show me how to do that? Also how do I check the R square for the fit? Thank you.
Is R-square formula unavailable? Also, if you already learn how to fit using the Arrhenius function, what obstacles are you facing with the Arrhenius plus linear function?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by