Modelling chemical reactions by stochastic methods
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am quite new on matlab so sorry for bothering you. I am trying to model the following reactions (all are molecules)
A+A-----C rate constant k1=0.001 A decreases by 2 Also given that a reaction happens the probability is k1*A(A-1)*R
A+B-----D rate constant k2=0.01 A and B decreases by 1 probability is A*B*(k2)/(R
u-----A rate constant k3=1.2 A increases by 1 probability is (k3)/R
u----B rate constant k4=1) B increases by 1 probability is (k4)/R
And t can be calculated from the exprnd function
Now i have that the total rate is R= A(A-1)*k1+AB*k2+k3+k4
Now my question is this, I want to create an array of three columns time, A and B and an appropriate number of columns. Now using the rate constants above create a for loop, calculate total R, calculate t from exprnd function, and finally use a random sample to determine which reaction occurs at t+dt. Then i would need to update the values of A, B and time in my inital vector accordingly. PLEASE i am quite new with matlab may someone help me writing this code! Note( we can get t as f(t)= R*e^(-RT) so we use the exprnd code)
I am not being lazy this is the last part of my investigation i have created this model from scratch! PLEASE HELP ME!
0 commentaires
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!