- #1
J-bonz
- 6
- 0
I am trying to replicate an example problem that was found in an "into to combustion book"... And of course, yes it is for school. Unfortunately there is no MATLAB class offered but, they expect us to know it... I tried the example in MATLAB help found under the ode45 and couldn't even get this to run. I thought if i could get it to run, I would use this as a model for the problem i am working on... Solving four equations simultanously
Example problem code:
-----------------------------------------------------------
function dy = rigid(t,y)
dy = zeros(3,1);
dy(1) = y(2) * y(3);
dy(2) = -y(1) * y(3);
dy(3) = -0.51 * y(1) * y(2);
options = odeset('RelTol', 1e-4, 'AbsTol', [1e-4 1e-4 1e-5]);
[T,Y] = ode45(@rigid, [0 12], [0 1 1], options);
plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:3),'.');
-----------------------------------------------------------
This Code Shows an error in the "dy(1) = y(2) * y(3);" line.
The equations i really need to solve for are as follows
-----------------------------------------------------------
dF/dt = -4.7316(10^8) * (F^0.1) * (O^1.65) * exp(-15098/T)
F(0) = .023918
dO/dt = 16 * (dF/dt)
O(0) = .382681
dP/dt = -17 * (dF/dt)
P(0) = 0
dT/dt = -3715.19* (dF/dt)
T(0) = 753
-----------------------------------------------------------
Any Help would greatly be appreceated, its due monday...
and it seems everything else is.
Thanks,
Jack
Example problem code:
-----------------------------------------------------------
function dy = rigid(t,y)
dy = zeros(3,1);
dy(1) = y(2) * y(3);
dy(2) = -y(1) * y(3);
dy(3) = -0.51 * y(1) * y(2);
options = odeset('RelTol', 1e-4, 'AbsTol', [1e-4 1e-4 1e-5]);
[T,Y] = ode45(@rigid, [0 12], [0 1 1], options);
plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:3),'.');
-----------------------------------------------------------
This Code Shows an error in the "dy(1) = y(2) * y(3);" line.
The equations i really need to solve for are as follows
-----------------------------------------------------------
dF/dt = -4.7316(10^8) * (F^0.1) * (O^1.65) * exp(-15098/T)
F(0) = .023918
dO/dt = 16 * (dF/dt)
O(0) = .382681
dP/dt = -17 * (dF/dt)
P(0) = 0
dT/dt = -3715.19* (dF/dt)
T(0) = 753
-----------------------------------------------------------
Any Help would greatly be appreceated, its due monday...
and it seems everything else is.
Thanks,
Jack