incidenceMatrix

Method of mdss.

Compute the incidence matrix of the equation system of an mdss model.

Source: src/model/@mdss/incidenceMatrix.m

Syntax

I = incidenceMatrix(sys)

Description

incidenceMatrix returns the structural incidence matrix I of the model: which variables occur in which equations. It dispatches on the model’s tensor type, calling computeIncidenceMatrix on the underlying CPNTensor or TTTensor.

In I, rows are all equations and columns are all signals. A nonzero entry I(i, j) means signal j appears in equation i. Use the model’s index vectors to slice I into meaningful blocks afterwards: equalityIndex, inequalityIndex (rows) and stateDeltaIndex, stateIndex, inputIndex, algebraicIndex, binaryIndex (columns).

The incidence structure is the basis for the sparsity-pattern reordering used by the simulator and by algebraicElimination.

Input arguments

Argument Description
sys The mdss model.

Output arguments

Output Description
I Incidence matrix, rows = equations, columns = signals.

Example

sys = stringParser.symbolicToMdss(["0 = m*xp1 - y1 - u1"; ...
                                   "0 = y1 - k*x1"], 0, ...
                                  ["xp","x","u","y","z"], ["m","k"], [1200, 3]);

I = incidenceMatrix(sys);

The two equations involve the signals xp1 (state derivative), x1 (state), u1 (input) and y1 (algebraic):

I stores this as equations × signals. Because the raw row/column order is internal, slice it with the index vectors to get a labelled view — here the two equalities against the four signals in the order [xp1 x1 u1 y1]:

cols  = [sys.stateDeltaIndex; sys.stateIndex; sys.inputIndex; sys.algebraicIndex];
block = full(I(sys.equalityIndex, cols))

which prints the incidence pattern

          xp1  x1  u1  y1
 eq1  ->    1   0   1   1
 eq2  ->    0   1   0   1

Each 1 marks that the signal occurs in that equation, each 0 that it does not.

See also

mdss · jacobian · CPNTensor · TTTensor


MyToolbox Documentation | Generated automatically by CI/CD pipeline