Using ODE 45 coupled ODEs
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Andreas Skovhøj
le 23 Oct 2019
Réponse apportée : Star Strider
le 23 Oct 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 commentaires
Réponse acceptée
Star Strider
le 23 Oct 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!