M = odeMassMatrix(value)
M = odeMassMatrix(value, name, value)
M = odeMassMatrix(name, value)
odeMassMatrix stores a mass matrix or mass matrix callback for the object ODE workflow.
| Object | Purpose | Used by |
|---|---|---|
| odeMassMatrix | Stores a reusable definition for the ode object workflow. | The matching ode property and solve. |
| Validation | Checks supported names and shapes at construction time. | Tests and errors stay explicit before integration. |
Public properties are MassMatrix, Singular, StateDependence, and SparsityPattern. The compatible aliases MassSingular, MStateDependence, and MvPattern are also accepted by the constructor.
Singular accepts yes, no, or maybe. StateDependence accepts none, weak, or strong. SparsityPattern accepts a numeric or logical square matrix and is passed to the solver options.
Without a mass matrix, defaults are Singular='maybe' and StateDependence='weak'. For a numeric mass matrix, Nelson infers Singular and uses StateDependence='none' unless values are supplied explicitly.
M = odeMassMatrix(2)
M = odeMassMatrix('MassMatrix', 2, 'Singular', 'no');
problem = ode('ODEFcn', @(t,y) -y, 'InitialValue', 1, 'MassMatrix', M);
result = solve(problem, 0, 1)
| Version | Description |
|---|---|
| 2.0.0 | initial version |