Find incidence matrix of system of equations
Find the incidence matrix of a system of five equations in five variables.
Create the following symbolic vector
eqs containing five
symbolic differential equations.
syms y1(t) y2(t) y3(t) y4(t) y5(t) c1 c3 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,
c3 are symbolic parameters (not variables) of the
vars = [y1(t), y2(t), y3(t), y4(t), y5(t)];
Find the incidence matrix
A for the equations
eqs and with respect to the variables
A = incidenceMatrix(eqs, vars)
A = 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1
Equations, specified as a vector of symbolic equations or expressions.
Variables, specified as a vector of symbolic variables, symbolic
functions, or function calls, such as
A— Incidence matrix
Incidence matrix, returned as a matrix of double-precision values.