Solving the Kinetic equations by Matlab coding

1. R=R∞[1-exp -kt]
2. R= R∞ {1-1/ kt [1-exp(-kt)]}
where R is the recovery in %; k is the first-order rate constant, t is the time [s], and R∞ is the maximum (theoretical) recovery. These ara 2 example of Kinetic rate eqaction.
I have values of R and t, R∞ is a maximum value of R(recovery), I want to know the value of k..? in this eqations
How to solve this eqactions by using Matlab coding and finally plot the graph of time(t) v/s recovery (R)..?
Example values
Time(t)= 0 , 10, 30, 60,120, 210
Recovery(R) % = 0, 44.90, 71.39, 76.37, 82.81, 87.68

Answers (1)

Try this:
% % % k(1) = R_Inf, k(2) = k
R1fcn = @(k,t) k(1).*(1-exp(-k(2).*t));
R2fcn = @(k,t) k(1).*(1 - (1-exp(-k(2).*t))./(k(2).*t));
t = [0 10 30 60 120 210];
R = [0 44.90 71.39 76.37 82.81 87.68];
[k1,fv1] = fminsearch(@(k) norm(R - R1fcn(k,t)), [100; 0.05]);
[k2,fv2] = fminsearch(@(k) norm(R - R2fcn(k,t)), [100; 0.05]);
figure
plot(t, R, 'p')
hold on
plot(t, R1fcn(k1,t))
plot(t, R2fcn(k2,t))
hold off
grid
legend('Data', 'R_1', 'R_2', 'Location','SE')
For whatever reason, ‘R2fcn’ is not fitting at all well. If I understand your expression for it, it appears to be coded correctly.
The ‘k’ constant is ‘k(2)’ in both functions.

4 Comments

Thank You so much dear and I have query
Both 2 eqaction are diffrent, k is constant in both eqactions.
we findout the k values in these eqaction than how u consider the k(1) = R_Inf, k(2) = k
My pleasure!
The second equation (that I call ‘R2fcn’) does not appear to be a good fit to your data, and may not even be valid. Look carefully at it, since your original posting of it may not be correct.
You will likely need to have fminsearch continue to iterate in order to find an acceptable fit, or use a different optimisation routine (such as lsqcurvefit or ga, the genetic algorithm function). That will give you the parameter estimates you want.
Thank You dear,
I want know the value of k, R_Inf and R2( R- squear)
How to check the values..?
Those parameter estimates (as noted previously) are the elements of ‘k’:
% % % k(1) = R_Inf, k(2) = k
You will have to calculate ‘R2( R- squear)’ from whatever information is available, since I have no idea what it refers to.

Sign in to comment.

Categories

Asked:

on 5 Aug 2020

Commented:

on 11 Aug 2020

Community Treasure Hunt

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

Start Hunting!