MATLAB Answers

How to use ODE solvers for a 2nd order differential equation with a Mass Matrix ?

6 views (last 30 days)
I would like to simulate a system which comes at the following form:
where the Mass Matrix (M) is a 2x2 matrix. I simulated the system by using the inverse of the M matrix (it is positive definite, so I can do that) but I would also like to simulate it by using the 'Mass' matrix option that can be provided to the ode solver. If I use the inverse of the matrix, then the system breaks down to 4 first order ODEs and it's beiing simulated. How can I break the system to first order ODEs and use the mass matrix option ? My issue is that as far as I know, ODE solvers solve first order ODEs. The q variable denotes angles of a 2-DOF robotic manipulator, so its dimension is 2x1.


Sign in to comment.

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 23 Nov 2020
As far as I understand all you have to is to do the same conversion from a system of second order ODEs to a twice as big system of first-order ODEs by introducing an angular velocity vector, this should give you a mass-matrix that has a 2-by-2 identity-matrix and your M in the upper left and lower right and zeros in the other quadrants:
[1 0 0 0
0 1 0 0
0 0 M11 M12
0 0 M21 M22]*[dq1dt;dq2dt;dv1dt;dv2dt] = [v1;v2;C(q,v)*v - G(q) + tau]
(in a very lazy formatting...)

  1 Comment

Teo Protoulis
Teo Protoulis on 23 Nov 2020
That's exactly what I was searching for. I had found it but thanks for the answer anyway!

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!