Mon 04 Apr 2016 07:58:40 AM UTC, comment #2:
The problem is also present in the development version; we must care to not forget the mass matrix when computing the solution. In ode45.m, line 262 :
the mass matrix is defined in the constant case but not used. I suggest to use the parameter "fun" the same way a dynamic mass matrix is handled, e.g. line 301, add the bottom lines :
Do not forget to uncomment the mass matrix line 268 (it will be equal to identity)
|
Fri 01 Apr 2016 12:09:36 PM UTC, original submission:
Package : odepkg v0.8.5
Functions : any solver (ode45, ode54, etc) used in the package
Description :
Any use of the 'Mass' option with one of the solver (though the settings function 'odeset') will fail if the mass matrix is constant; the function runs without error/warning but the result is incorrect.
This problem does not occur when a function handle @mass is passed as the mass option.
Fix :
The change must be done in every solver. For example in ode54.m, line 232, mass definition must be uncommented :
to become :
and then used line 367 :
must be changed into
Important remark : in the case of a constant matrix we dont need to perform a matrix division at each solver step, because the computation time will greatly increase. It is better to compute the inverse of the mass matrix before the main loop, and then do a multiplication (rather than a matrix division). This gives :
l.227 :
and line 356 :
|