Solving a coupled set of differential equations in MATLAB?

1 view (last 30 days)
Hello,
I have a set of coupled differential equations Ax + B dx/dt + C dy/dt = D Ey + F dy/dt + G dx/dt = H
The problem I have is that each derivative depends on the derivative of the other variable. Specifically dx/dt depends on dy/dt (not just merely y) and dy/dt also depends on dx/dt (not just merely x). Can I solve this system somehow using ode45? If not, is there some other differential equation solver I can use?

Accepted Answer

Kevin Bachovchin
Kevin Bachovchin on 13 Jan 2012
I was not able to find an easy way to do this. I had to define a new variable and use substitution in order to solve.
So originally my system of differential equations is Ax + B dx/dt + C dy/dt = D Ey + F dy/dt + G dx/dt = H
In matrix notation this can be represented as
[B C ; G F] [dx/dt ; dy/dt] = -[A 0 ; 0 E] [x ; y] + [D ; H]
Now we need to define new variables x_hat and y_hat
Let [x_hat ; y_hat] = [B C ; G F] [x ; y] So, in reverse, [x ; y] = inv([B C ; G F]) [x_hat ; y_hat]
Making this substitution into the differential equation system
[dx_hat/dt ; dy_hat/dt] = -[A 0 ; 0 E] inv([B C ; G F]) [x_hat ; y_hat] + [D ; H]
Now this system of differential equations can be solved for by ode45 in terms of x_hat and y_hat (since the derivatives of x_hat and y_hat do not depend on each other).
Of course, once you have the solution in terms of x_hat and y_hat, it's necessary to convert back to x and y.

More Answers (1)

ashish
ashish on 13 Jan 2012
I do have the similar equation. Can you help me solve this?

Community Treasure Hunt

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

Start Hunting!