Why won't this ODE setup work?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to solve a system of differential equations with initial conditions in order to run simulations over time. Here is my code.
k1=23.18*10^3;
k2=192.7;
k_1=357.4;
k_2=.03;
syms cs(t) ces(t) cp(t) ce(t)%solving diff eq
eqs=diff(cs) == (-k1*ce*cs)+(k_1*ces);
eqces=diff(ces) == ((-k_1-k2)*ces)+(k1*ce*cs)+(k_2*ce*cp);
eqcp=diff(cp) == (-k_2*ce*cp)+(k2*ce*cp);
eqce=diff(ce) == (-k1*ce*cs)-(k_2*ce*cp)+((k_1+k2)*ces);
odes=[eqce; eqs; eqces; eqcp]
cond1 = ce(0) == (5*10^(-8));
cond2 = cs(0) == .004;
cond3= ces(0) == 0;
cond4= cp(0) == 0;
conds=[cond1; cond2; cond3; cond4];
[ceSol(t), csSol(t), cesSol(t), cpSol(t)]= dsolve(odes,conds);%I get an error on this line that says invalid indexing or function definition
ceSol(t)= simplify(ceSol(t));
csSol(t)= simplify (csSol(t));
cesSol(t)= simplify (cesSol(t));
cpSol(t)= simplify (cpSol(t));
Any idea where I'm going wrong?
0 commentaires
Réponses (1)
Jan
le 9 Fév 2022
Omit the "(t)" in the output:
[ceSol, csSol, cesSol, cpSol]= dsolve(odes,conds);
2 commentaires
Jan
le 9 Fév 2022
When I run the code, I get the warning: "Unable to find symbolic solution". Most ODEs do not have a symbolic solution, but you have to solve them numerically. Do you have any reason to assume, that there is a symbolic solution of your equation?
Voir également
Catégories
En savoir plus sur Equation Solving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!