MATLAB Answers

Kurt
0

Help solving these ODEs

Asked by Kurt
on 10 Nov 2018 at 23:25
Latest activity Answered by Walter Roberson
on 10 Nov 2018 at 23:52
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

Sign in to comment.

Products


Release

R2018b

1 Answer

Answer by Walter Roberson
on 10 Nov 2018 at 23:52

Use different initial conditions. For example 0.1 0.1 0.1 0.1 0.1 0.1

  0 Comments

Sign in to comment.