ODE45 system of equations inaccurate?
Show older comments
So I have a system of equations that I have to solve and plot for 3 separate concentrations C1,C2,C3. The initial conditions are c1(0) = .063, c2(0) = 700, and c3(0) = 5.6
There is no way that the graphs I'm getting with this are right. I know the equations are all right but did I miss something or do something incorrectly? I attached an image of the equations.
a = 1;
b = (2*(10^-3));
d = (4*(10^-4));
f = (4*(10^-8));
c1(1) = .063;
c2(1) = 700;
c3(1) = 5.6;
c1prime = @(x1,y1) (-a*(c1^3)) + (b*(c3)) + (d*(c3^4)) - f*(c2^4)*(c1^4);
c2prime = @(x2,y2) (d*(c3^4)) - f*(c2^4)*(c1^4);
c3prime = @(x3,y3) (a*(c1^3)) - (b*c3) - (d*(c3^4)) + f*(c2^4)*(c1^4);
options = odeset('RelTol',10^-7,'AbsTol',10^-9);
[C1 Y1] = ode45(c1prime,[0 5],.063,options);
[C2 Y2] = ode45(c2prime,[0 5],700,options);
[C3 Y3] = ode45(c3prime,[0 5],5.6,options);
plot(C1,Y1,'r',C2,Y2,'b',C3,Y3,'g')
Accepted Answer
More Answers (0)
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!