Parameter Estimation for a Chemical Reaction
Introduction
This application estimates the rate parameters for a reversible reaction with dimerization of an intermediate.
A+B ⇆k__2k__1 C
C+C⇄k__4k__3D
It does this by doing the following:
Parameterizing (with respect to k__1,k__2,k__3 and k__4) the numerical solution of the different equations that describe the reaction kinetics
Calculating the sum of the square of the errors between the model predictions and experimental data
Minimizing the sum of the square of the errors to find the best fit values of k__1,k__2,k__3 and k__4
restart:withplots:withOptimization:
Parameters and Experimental Data
A__0≔2.1: B__0≔3.1:
Concentrations of C and D over time
times≔07142128354249566370:
C_exp≔01.0651.3830.97931.1070.72890.72360.46740.60310.61490.3369:
D_exp≔00.00580.22030.40190.36380.4560.50140.7150.47230.72190.7294:
Reaction Kinetics
de1≔ⅆⅆtC__Ct=k__1⋅A__0−C__Ct−2 C__Dt⋅B__0−C__Ct−2⋅C__Dt−k__2⋅C__Ct−2⋅k__3⋅C__Ct2+2⋅k__4⋅C__Dt:
de2≔ⅆⅆtC__Dt=k__3⋅C__Ct2−k__4⋅C__Dt:
ic≔C__C0=0,C__D0=0:
Sum of Square of Errors
res≔dsolvede1,de2,ic,parameters=k__1,k__2,k__3,k__4,numeric:
sse≔prock__1,k__2,k__3,k__4 local i; resparameters=k__1,k__2,k__3,k__4: addC_expi−rhsselecthas,restimesi,C__C2+D_expi−rhsselecthas,restimesi,C__D2, i=1 .. numelemstimes end proc:
sse0.01,0.002,0.02,0.002
2.00578059621453
Minimize the Sum of the Square of the Errors
optPars≔Minimize'sse'k__1,k__2,k__3,k__4,initialpoint=k__1=0.011 ,k__2=0.002,k__3=0.02,k__4=0.002,assume=nonnegative,optimalitytolerance=0.00001
optPars≔0.231411169620961532,k__1=0.0632294154111440,k__2=0.0186953983808340,k__3=0.0144413290425876,k__4=0.
Compare Experimental Results to Model
resparameters=optPars2:
p_C≔odeplotres,t,C__Ct,t=0..70,color=ColorTools:-Color149255,165255,166255,legend=C,filled=true:
p_C_exp≔plottimes,C_exp,style=point,symbol=solidcircle,symbolsize=20,color=ColorTools:-Color149255,165255,166255:
p_D≔odeplotres,t,C__Dt,t=0..70,color=ColorTools:-Color58255,83255,155255,legend=D:
p_D_exp≔plottimes,D_exp,style=point,symbol=solidcircle,symbolsize=20,color=ColorTools:-Color58255,83255,155255:
displayp_C,p_C_exp,p_D,p_D_exp,symbol=solidcircle,size=800,400,axesfont=Calibri,legendstyle=font=Calibri,labels=Time,Concentration,labelfont=Calibri,labeldirections=horizontal,vertical,gridlines
Download Help Document