MATLAB: Solve a system of differential equations


System is like this:
Where A=A(t), B=B(t), C=C(t) and A'=dA/dt and 3 initial conditions exist.
m1 m2 m3 k1 k2 …are constants
Please tell me how to solve it,I already tried dsolve but there is no explicit solution
A link to a tutorial would be useful too.
And what this set of differential equations is called like ODE OR PDE?

Best Answer

  • Hi Vahid,
    did you already try to solve it numerically? It should be straightforward to solve using ode45. You function that you pass to ode45 should look something like
    function dy = fun(t, x, m1, m2, k1, k2, C)
    A = x(1);
    B = x(2);
    C = x(3);
    dA = -A*exp(k1/C);
    % etc
    dy = [dA; dB; dC];
    and then you call ode45 with
    [t,y] = ode45(@(t,x) fun(t, x, m1, m2, k1, k2, C), ...)
  • Related Question