Using ODE solvers with interlinked variables

3 views (last 30 days)
Kelly
Kelly on 28 Jan 2015
Answered: Torsten on 29 Jan 2015
Hello,
I am not really sure how to phrase my problem, so apologies if it is a little difficult to understand. I will not post my exact problem, but will use similar functions to that which I am coding for.
I have already managed to use an ODE solver for the following function: dB(t)/dt=A(t)-B(t) and have managed to code successfully for this and plotting my function for B(t).
However, I must now extend this and solve the following equation: dA(t)/dt=B(t)+dB(t)/dt-A(t)(1+c) such that c is a constant. I am a little confused on how I would code for this as there are now two differentials in the equation. I am assuming that since I have already solved the first equation, that by isolating dA(t)/dt I can solve this somehow by referring back to my known values for B(t) and dB(t). I am not sure if this makes sense, however my code is working fine with the simpler code and I am just a little confused as to how you would introduce a second unknown into the differential equation.
I am looking for just a little guidance as to how I would now solve the second equation.
Many thanks! :)

Answers (1)

Torsten
Torsten on 29 Jan 2015
Just insert A(t)-B(t) for dB(t)/dt in the second equation:
dA(t)/dt=B(t)+(A(t)-B(t))-A(t)*(1-c)
Simplifying the right-hand side gives
dA(t)/dt = c*A(t).
Best wishes
Torsten.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!