Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

solving coupled differential equation

1 view (last 30 days)
saman ahmadi
saman ahmadi on 25 Apr 2020
Closed: John D'Errico on 25 Apr 2020
hi. i am trying to solve two coupled differential equation as below:
m1x"+m2ry"=-k1(2x1-x2-x0)
m2x"+My"=-k2x+Ky-f
Note: m1,m2,r,k1,x2,x0,M,k2,K,f are known

Answers (1)

John D'Errico
John D'Errico on 25 Apr 2020
Edited: John D'Errico on 25 Apr 2020
What is the problem? Is it that you do not know how to turn a second order ODE into two first order ODES? You can look at the examples in the docs for ODE45 to see how to do that. The idea is simple though. If
y'' = f(t,y)
then just create a new unknown u, such that
y' = u
u' = f
Assuming you understand that, then I sssume you don't understand how to transform this system into a pair of second order ODEs that have decoupled second order terms
m1x"+m2ry"=-k1(2x1-x2-x0)
m2x"+My"=-k2x+Ky-f
That would most easily have you transform the problem by what you could think of as a Gaussian elimination on the left hand side. As long as the 2x2 matrix
M = [m1,m2*r; m2,M]
is non-singular, then this is itself easy. Just add and subtract the appropriate multiples of your equations to form two new equations with uncoupled second oder derivatives. So you can think of that decoupling as a transformation of variables.
The result would then be two new ODES that are now uncoupled in those second order differentials. Convert them each into each a pair of first order ODEs and you have a system of FOUR ODEs for ODE45 to solve. WTP?
Of course, IF you read the help for ODE45, you would have found this option:
ode45 can solve problems M(t,y)*y' = f(t,y) with mass matrix M that is
nonsingular. Use ODESET to set the 'Mass' property to a function handle
MASS if MASS(T,Y) returns the value of the mass matrix. If the mass matrix
is constant, the matrix can be used as the value of the 'Mass' option. If
the mass matrix does not depend on the state variable Y and the function
MASS is to be called with one input argument T, set 'MStateDependence' to
'none'. ODE15S and ODE23T can solve problems with singular mass matrices.
You would need to convert the problem into 4 first oder ODEs, with a corresponding 4x4 mass matrix, something like:
x' = u
y' = v
m1*u'+m2*r*v' =-k1*(2x1-x2-x0)
m2*u'+M*v'=-k2*x+K*y-f
You still need 4 initial conditions. The 4x4 mass matrix should now be easy to write from the above system.
One nice thing is, in the case where your mass matrix happens to be singular, the help even tells you which solvers can handle that class of problem.

This question is closed.

Community Treasure Hunt

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

Start Hunting!