Modeling and Matlab

1. Apr 23, 2006

Deuterio

I'm modeling a chemical reactor and I have to solve a system of ODE's like that:

dX/dV = a*X
dT/dV = b*(dX/dV) - c*(T-T0)

I've been a Matlab user for so long but I've never seen a solution of this kind of system. I've tried to solve using ode45 but it didn't work. I've searched in books and/or homepages about Matlab and I haven't found any tip.
If some one here could help me I'd be so grateful.

Thanks

2. Apr 23, 2006

jamesrc

I may be a little rusty, but I think if you define your state as:
s = [X, dX/dV, T, dT/dV], then you can use ode45 (or any other MATLAB ode solver). (I'm assuming you've used the solvers before and you're just having trouble with this problem.) So your derivative function will look something like this:

...
function sdot = deriv(V,S)
% Current values of state parameters
X = S(0);
dXdV = S(1);
T = S(3);
dTdV = S(4);

% Updated values of derivatives of state parameters
dXdV=a*X;
d2XdV2 = a*dXdV;
dTdV = b*(dXdV) - c*(T-T0);
d2TdV2 = b*d2XdV2 - c*dTdV;

sdot = [dXdV, d2XdV2, dTdV, d2TdV2];

3. Apr 24, 2006

shaner-baner

You could put the system in a more standard form. i.e. replace the occurance of dx/dv in the second equation with a*X, not to mention that I think you can probably solve it out by hand because the system is "triangular"

4. Apr 28, 2006

Deuterio

Thanks

Both options have worked properly.