Using ODE 45 coupled ODEs

8 ビュー (過去 30 日間)
Andreas Skovhøj
Andreas Skovhøj 2019 年 10 月 23 日
回答済み: Star Strider 2019 年 10 月 23 日
Hi!
I am supposed to solve these two linear ODEs
k = 0.0440;
C_A0 = 0.3045;
epsilon = 2;
alpha = 0.001;
F_A0 = 2.5;
rho = 0.001;
ode1 = diff(y) == -(alpha/2*y)*(1+epsilon*X)*rho;
ode2 = diff(X) == k*C_A0*(1-X)/(F_A0*1+epsilon*X)*y*rho;
I cant figure out how to use ode45 but i have tried something like this by using some other answers which i dont understand..
function dz = myode2(v,z)
syms v z
alpha = 0.001;
C0 = 0.3;
esp = 2;
k = 0.044;
f0 = 2.5;
dz = zeros(2,1);
dz(1) = k*C0/f0*(1-z(1)).*z(2)./(1-esp*z(1));
dz(2) = -alpha*(1+esp*z(1))./(2*z(2));
ode45(@myode2,[0 500],[0 1])
end
This does not work tho..
Anyone knows how to solve this by ode45?

採用された回答

Star Strider
Star Strider 2019 年 10 月 23 日
Start with what you already have:
syms X(t) y(t) Y
k = 0.0440;
C_A0 = 0.3045;
epsilon = 2;
alpha = 0.001;
F_A0 = 2.5;
rho = 0.001;
ode1 = diff(y) == -(alpha/2*y)*(1+epsilon*X)*rho;
ode2 = diff(X) == k*C_A0*(1-X)/(F_A0*1+epsilon*X)*y*rho;
then use odeToVectorField and matlabFunction (linked to in that doeumentation) to create your ODE anonymous function.
This appears to be a homework assignment, so I leave the rest to you.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by