フィルターのクリア

Why won't this ODE setup work?

1 回表示 (過去 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 Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by