daetools::incidenceMatrix

Find incidence matrix of system of 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

A := daetools::incidenceMatrix(eqs,vars)

Description

A := daetools::incidenceMatrix(eqs,vars) for m equations eqs and n variables vars returns an m-by-n matrix A, where A[i,j] = 1 if eqs[i] contains vars[j] or any derivative of vars[j]. All other elements of A are 0s.

Examples

Example 1

Find the incidence matrix of a system of five equations in five variables.

Create the following vector eqs containing five symbolic differential equations.

eqs := [diff(y1(t),t) = y2(t),
        diff(y2(t),t) = c1*y1(t) + c3*y3(t),
        diff(y3(t),t) = y2(t) + y4(t),
        diff(y4(t),t) = y3(t) + y5(t),
        diff(y5(t),t) = y4(t)]:

Create the vector of variables. Here, c1 and c3 are symbolic parameters (not variables) of the system.

vars := [y1(t), y2(t), y3(t), y4(t), y5(t)]:

Find the incidence matrix A for the equations eqs with respect to the variables vars.

A := daetools::incidenceMatrix(eqs, vars)

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 matrix of 1s and 0s.

Introduced in R2014b