Using ODE 45 coupled ODEs
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Andreas Skovhøj
am 23 Okt. 2019
Beantwortet: Star Strider
am 23 Okt. 2019
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?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 23 Okt. 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!