Why won't this ODE setup work?

2 次查看(过去 30 天)
AUSTIN WHITELEY
AUSTIN WHITELEY 2022-2-9
评论: Jan 2022-2-9
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?

回答(1 个)

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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by