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?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With