daetools::massMatrixForm

Extract mass matrix and right side of semilinear system of differential algebraic equations

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

MF := daetools::massMatrixForm(eqs,vars)

Description

MF := daetools::massMatrixForm(eqs,vars) returns a list containing the mass matrix M and the right side of equations F of a semilinear system of first-order differential algebraic equations (DAEs). Algebraic equations in eqs that do not contain any derivatives of the variables in vars correspond to empty rows of the mass matrix M.

The mass matrix M and the right side of equations F refer to the form M(t,x(t)x'(t)) = F(t,x(t)).

Examples

Example 1

Convert a semilinear system of differential algebraic equations to mass matrix form.

Create the following system of differential algebraic equations. Here, x1(t) and x2(t) represent state variables of the system. The system also contains symbolic parameters r and m, and the parameter f(t, x1(t), x2(t)).

eqs :=
 [m*x2(t)*diff(x1(t), t) + m*t*diff(x2(t), t) = f(t, x1(t), x2(t)),
  x1(t)^2 + x2(t)^2 = r^2];

vars := [x1(t), x2(t)];

Find the mass matrix form of this system.

MF := daetools::massMatrixForm(eqs, vars):
M := MF[1];
F := MF[2]

Parameters

eqs

A list or a vector of equations or expressions in the state variables vars and their derivatives. Expressions represent equations with 0 right side.

vars

A list or a vector of identifiers or expressions, such as [x1(t), x2(t)].

Return Values

A list of two matrices. The first entry is the mass matrix. The number of rows is the number of equations in eqs, and the number of columns is the number of variables in vars. The second entry is an n-by-1 matrix of the right side of equations, where n is the number of equations eqs.

Introduced in R2014b