Help solving these ODEs

1 次查看(过去 30 天)
Kurt
Kurt 2018-11-10
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')

回答(1 个)

Walter Roberson
Walter Roberson 2018-11-10
Use different initial conditions. For example 0.1 0.1 0.1 0.1 0.1 0.1

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by