Borrar filtros
Borrar filtros

Why won't this ODE setup work?

2 visualizaciones (últimos 30 días)
AUSTIN WHITELEY
AUSTIN WHITELEY el 9 de Feb. de 2022
Comentada: Jan el 9 de Feb. de 2022
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?

Respuestas (1)

Jan
Jan el 9 de Feb. de 2022
Omit the "(t)" in the output:
[ceSol, csSol, cesSol, cpSol]= dsolve(odes,conds);
  2 comentarios
AUSTIN WHITELEY
AUSTIN WHITELEY el 9 de Feb. de 2022
After making that change it returns [ceSol, csSol, cesSol, cpSol] as empty variables. Is there anything else I need to do?
Jan
Jan el 9 de Feb. de 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?

Iniciar sesión para comentar.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by