Solving the Kinetic equations by Matlab coding
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Star Strider
on 5 Aug 2020
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
Star Strider
on 11 Aug 2020
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.
See Also
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!