massMatrixForm
Writes a DAE system in mass-matrix form M*y' = F(t, y).
Category: Mathematics > Equation Solving
Syntax
[M, F] = massMatrixForm(eqs, vars)
Returns the mass matrix M and the right-hand side F.
Description
Many solvers (ode15s, ode23t) accept problems as M(t,y) y' = f(t,y). massMatrixForm extracts that structure from the equations. It works only if the system is linear in the derivatives, and the result can feed odeFunction and the Mass option of odeset.
Input arguments
eqs- Vector of symbolic equations.
vars- Vector of unknown symbolic functions, in the order of the columns of
M.
Output arguments
M- Symbolic mass matrix. Rows of zeros mark algebraic equations.
F- Column vector of expressions in
tand the variables.
Example
One differential and one algebraic equation
syms x(t) y(t)
eqs = [diff(x,t) == y, x + y == 1];
[M, F] = massMatrixForm(eqs, [x y])
Output
M =
[1, 0]
[0, 0]
F =
y(t)
1 - x(t) - y(t)