Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the mass matrix in ode solvers in MATLAB?

Without using a mass matrix, ode solvers like ode45 can solve y'=f(t,y).

But there is an option of mass matrix in ode solvers for problems that involve a "mass" matrix, M(t,y)y'=f(t,y).

What exactly is the "mass" matrix? Does this term come from the mass of mass-spring system oscillation? I cannot find an example code about this in the documentation. Also, it seems that I can encode information about t and y in f(t,y) in the equation of y'=f(t,y). In what situation/example will M(t,y)y'=f(t,y) arise where M(t,y) is needed?

like image 746
Ka-Wa Yip Avatar asked Jun 26 '16 04:06

Ka-Wa Yip


2 Answers

This is explained fully here in the documentation for odeset. Yes, it can be related to the mass/inertia term for second order systems, but it can also represent different parameters in other systems that have the same form. This option can improve efficiency in some cases and handle singular (non-invertible) mass matrices (uncommon is physical systems).

The book Solving ODEs with Matlab (PDF) by Shampine, et al. provides further details and a nice example (section 2.3.2, page 105) – see batonode in Matlab.

like image 187
horchler Avatar answered Sep 20 '22 04:09

horchler


The mass matrix can be used to solve coupled ordinary differential equations and algebraic equations simultaneously.

For example

y'(1) = 2y(1) + 3(y)^2
y'(2) = 5y(1) - 2y(2)^4
0 = y(1)^3 + y(3) + 2
0 = y(2)^4 + y(4) - 8

can be solved using ode23t with a mass matrix as:

M =
[1 0 0 0
0 1 0 0
0 0 0 0
0 0 0 0]

Note than few ode solvers cannot handle singular mass matrix well. ode23t and ode15s can do this job.

For more details refer: https://se.mathworks.com/help/matlab/ref/odeset.html#input_argument_namevalue_d119e730030

like image 34
Anirudh Saraf Avatar answered Sep 20 '22 04:09

Anirudh Saraf