Help solving these ODEs
1 view (last 30 days)
Show older comments
These is what I have came up with so far, however it isnt working rite.
syms CA(z) CB(z) CC(z) CD(z) CE(z) CF(z)
eqn1 = diff(CA, z) == ((-0.1)*CA*CB*CC^2-(0.05)*CA*CD-(0.15)*CA*CF);
eqn2 = diff(CB, z) == ((-0.1)*CA*CB*CC^2+(0.3)*CA*CF);
eqn3 = diff(CC, z) == ((-2)*(-0.1)*CA*CB*CC^2);
eqn4 = diff(CD, z) == ((0.1)*CA*CB*CC^2-(0.05)*CA*CD);
eqn5 = diff(CE, z) == ((0.05)*CA*CD);
eqn6 = diff(CF, z) == ((0.05)*CA*CD-(0.15)*CA*CF);
[odes, vars] = odeToVectorField(eqn1, eqn2, eqn3, eqn4, eqn5, eqn6);
fun = matlabFunction(odes,'Vars',{'t','Y'});
x0 = [0 0 0 0 0 0];
tspan = [0 25];
[t, sol] = ode45(fun,tspan,x0);
CA = sol(:,2);
CB = sol(:,1);
CC = sol(:,3);
CD = sol(:,4);
CE = sol(:,5);
CF = sol(:,6);
plot(t,CA,t,CB,t,CC,t,CD,t,CE,t,CF)
legend('CA','CB','CC','CD','CE','CF','Location','southeast')
0 Comments
Answers (1)
Walter Roberson
on 10 Nov 2018
Use different initial conditions. For example 0.1 0.1 0.1 0.1 0.1 0.1
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!