incidenceMatrix

Incidence matrix showing which variables appear in which equations.

Category: Mathematics > Equation Solving

Syntax

M = incidenceMatrix(eqs, vars)

Returns a 0-1 matrix with a 1 where an equation contains a variable.

Description

The matrix records only the structure of the system, not the coefficients. It is used to judge whether a DAE can be split into blocks or whether its index is high, as findDecoupledBlocks and isLowIndexDAE do.

Input arguments

eqs
Vector of symbolic equations.
vars
Vector of symbolic functions, such as [x1(t) x2(t)].

Output arguments

M
Matrix with one row per equation and one column per variable.

Example

Structure of two equations

syms x1(t) x2(t) x3(t)
eqs = [x1 + x2 == 1, x2*x3 == 0];
incidenceMatrix(eqs, [x1 x2 x3])
Output
ans = 2×3

     1     1     0
     0     1     1

See also

findDecoupledBlocks isLowIndexDAE massMatrixForm equationsToMatrix