Solving Ordinary Differential Equations using Mass Matrix

2 views (last 30 days)
I am simulating a system of 14 ODEs in the form of mass matrix representation. I have a function that computes the mass matrix but my problem is that the simulation time takes forever because there are components of the matrix that demand a really large number of computations. The size of the mass matrix is 14x14 (total of 196 elements) and it contains only 56 nonzero elements and the 49 of them strongly depend on the states of the system of equations. In order to improve the execution time I thought that it would be better to pass the sparsity pattern option to the solver (MvPattern) along with the 'MStateDependence' option set to 'strong'. When passing these two options do I also have to pass the function handle which points to the function that computes the mass matrix or will the solver use approximations to numerically generate the mass matrix ? The mass matrix is definitely nonsigular so I also pass the 'MassSingular' ('no') option to the solver. I tried inverting the matrix to solve the equations but it really takes forever.

Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!