jacobian

Method of mdss.

Evaluate the Jacobian of the model’s equations with respect to all signals.

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

Syntax

jacobianMatrix = jacobian(sys, stateDeltaVector, stateVector, inputVector, algebraicVector, binaryVector)

Description

jacobian returns the matrix of partial derivatives of every equation with respect to every signal, evaluated at the supplied point. With each equation written as f(ẋ,x,u,y,z)f(\dot{x}, x, u, y, z), the result is

J=f[ẋ;x;u;y;z], J = \frac{\partial f}{\partial [\dot{x};\, x;\, u;\, y;\, z]},

with one row per equation and one column per signal (in structure-matrix row order).

The six signal vectors are assembled into the full signal vector via the model’s index vectors, and the evaluation is delegated to the underlying tensor. For a CPNTensor the unified jacobian kernel is called; for a TTTensor the tensor-train path computeJacobianMatrixMdss is used.

Input arguments

Argument Description
sys The mdss model.
stateDeltaVector State-derivative values ẋ\dot{x} (nState entries).
stateVector State values xx (nState entries).
inputVector Input values uu (nInput entries).
algebraicVector Algebraic values yy (nAlgebraic entries).
binaryVector Binary values zz (nBinary entries; [] if none).

Output arguments

Output Description
jacobianMatrix Jacobian 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]);

% Jacobian at xp1 = 0, x1 = 0, u1 = 1, y1 = 0 (no binaries)
J = jacobian(sys, 0, 0, 1, 0, []);

The equations here are f1=1200ẋ1y1u1f_1 = 1200\,\dot{x}_1 - y_1 - u_1 and f2=y13x1f_2 = y_1 - 3\,x_1. J has one row per equation and one column per signal. As with incidenceMatrix, slice it with the index vectors to get a labelled view — the two equalities against [xp1 x1 u1 y1]:

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

which yields

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

Each entry is fi/signalj\partial f_i / \partial \text{signal}_j. Because both equations are linear, these derivatives are constant; for nonlinear (multilinear) terms the entries depend on the operating point passed to jacobian.

See also

mdss · functionValue · incidenceMatrix · msim · CPNTensor · TTTensor


MyToolbox Documentation | Generated automatically by CI/CD pipeline