Asked by Ian DSouza
on 28 Dec 2017

In MATLAB, I need to numerically integrate two ODE's. Say I have variables time 't', x1(t) and x2(x1).

First differeential equation: contains dervative with respect to x1

Second differeential equation: contains dervative with respect to time 't'

time doesn't explicitly occur in either equation.

But since these are coupled equations, how do I simultaneously integrate at least numerically in MATLAB.

Answer by Teja Muppirala
on 28 Dec 2017

You can get dx2/dt by multiplying dx2/dx1 * dx1/dt.

As a simple example say (I'll use x and y instead of x1 and x2 cause it's easier to see):

dy/dx = x

dx/dt = t

Then the analytic solution (ignoring integration constants) is

x = t^2/2

y = x^2/2 = t^4/8

You can verify that dy/dt = t^3/2 = x*t = dy/dx * dx/dt.

So, the equations you'd put into the ODE solver would be:

dy/dt = x*t

dx/dt = x

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## John D'Errico (view profile)

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/374722-simultaneously-numerically-integrate-coupled-ode-s-in-matlab#comment_519768

## Ian DSouza (view profile)

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/374722-simultaneously-numerically-integrate-coupled-ode-s-in-matlab#comment_519773

Sign in to comment.