Solving the Kinetic equations by Matlab coding
Mostra commenti meno recenti
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
Risposte (1)
Star Strider
il 5 Ago 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 Commenti
Bharath KL
il 10 Ago 2020
Star Strider
il 10 Ago 2020
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.
Bharath KL
il 11 Ago 2020
Star Strider
il 11 Ago 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.
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!