Borrar filtros
Borrar filtros

Using ODE 45 coupled ODEs

1 visualización (últimos 30 días)
Andreas Skovhøj
Andreas Skovhøj el 23 de Oct. de 2019
Respondida: Star Strider el 23 de Oct. de 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?

Respuesta aceptada

Star Strider
Star Strider el 23 de Oct. de 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.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by