Multilinear descriptor state-space model (implicit MTI).
Source: src/model/@mdss/mdss.m
An mdss object stores an implicit multilinear
time-invariant (iMTI) model: a set of implicit differential-algebraic
equations whose right-hand side is a purely multilinear function of the
state derivatives, states, inputs, algebraic variables and (optionally)
binary variables. It is the descriptor counterpart of the explicit mss model.
The model tensor lives in an mtiTensor (a CPNTensor (default) or
a TTTensor), and the
signals are described by explicit index vectors rather
than fixed blocks.
An iMTI model consisting of implicit multilinear equations
can be represented by a contracted tensor product
Here, the signal vector collects the state change , the states , the inputs , the algebraic variables and the binary variables :
The state change is the state derivative in continuous time and the state prediction in discrete time,
The model tensor , with denoting dimensions of length 2, contains the parameters of the implicit equations. While can have an arbitrary rank, the tensor is always rank 1 with a canonical polyadic (CP) decomposition
The variable
depends on the model base; see the
explicit model mss for the
base convention. The model class mdss currently only
supports the monomial base
().
An equivalent representation of the full model tensor can be achieved with a CP-decomposed parameter tensor
with factor matrices for and a parameter matrix , where is the number of product terms.
Exploiting that the first dimension of every factor matrix is of
length 2, the model tensor can be stored in the more compact
Canonical Polyadic Normalized (CPN) representation
implemented in the MTI-Toolbox. Normalizing every factor matrix column
with the 1-norm collapses each column to a single degree of freedom, so
the model tensor is represented by a structure matrix
(rows = signals, columns = terms), which holds the second rows of the
normalized factor matrices, and a parameter matrix
(rows = equations, columns = terms), which absorbs the column scalings.
See CPNTensor for
the tensor container that stores these matrices.
In CPN representation, an iMTI model is written as
The evaluation of the individual model equations is equivalent to a sum of products
where the structure matrix
selects which signals enter each product term and the parameter
matrix
holds the weight of the terms. In the monomial base
()
supported by mdss, the scalar factor function is
Which row of
is which signal โ and which row of
is which equation โ is recorded by the index vectors below, so
mdss never assumes a fixed signal ordering.
Build the model directly from its CPN matrices and index vectors. Take the continuous-time Sprottย B attractor (3 states, no inputs):
The structure matrix has one row per signal (here 3
state derivatives then 3 states) and one column per term; the
parameter matrix has one row per equation. Each column
of structureMatrix selects the signals in that term, and
the same column of parameterMatrix gives its
coefficient:
a = 0.4; b = 1.2; c = 1;
% xp1 xp2 xp3 x2x3 x1 x2 const x1x2
structureMatrix = [ 1 0 0 0 0 0 0 0 ; % xp1
0 1 0 0 0 0 0 0 ; % xp2
0 0 1 0 0 0 0 0 ; % xp3
0 0 0 0 1 0 0 1 ; % x1
0 0 0 1 0 1 0 1 ; % x2
0 0 0 1 0 0 0 0 ]; % x3
parameterMatrix = [-1 0 0 a 0 0 0 0 ; % eq1
0 -1 0 0 1 -b 0 0 ; % eq2
0 0 -1 0 0 0 c -1 ]; % eq3
sys = mdss(structureMatrix, parameterMatrix, ...
[1;2;3], ... % stateDeltaIndex (rows of xp1..xp3)
[4;5;6], ... % stateIndex (rows of x1..x3)
[], [], [], ... % inputIndex, algebraicIndex, binaryIndex
0, ... % timeStepSize (0 = continuous-time)
[1;2;3], []); % equalityIndex, inequalityIndexWhen every signal/equation count is a scalar and the
matrix row counts match, the index vectors are auto-expanded to
sequential [1..n], which is handy via the nameโvalue
form:
sys = mdss(structureMatrix = structureMatrix, parameterMatrix = parameterMatrix, ...
amountStateDelta = 3, amountState = 3, amountInput = 0, ...
amountAlgebraic = 0, amountBinary = 0, ...
timeStepSize = 0, amountEquality = 3, amountInequality = 0);Important: Auto-expansion assumes a fixed row order
Passing counts instead of explicit index vectors commits the matrices
to a defined layout. The structure matrix rows must be
ordered [stateDelta; state; input; algebraic; binary] and
the parameter matrix rows
[equality; inequality], each block filled sequentially. If
your rows follow a different order, pass explicit index vectors
instead.
| Syntax | Result |
|---|---|
sys = mdss() |
Empty object with an empty mtiTensor. |
sys = mdss(structureMatrix, parameterMatrix, stateDeltaIndex, stateIndex, inputIndex, algebraicIndex, binaryIndex, timeStepSize, equalityIndex, inequalityIndex) |
Build from CPN matrices + index vectors. All ten arguments are required. |
sys = mdss(mtiTensor, stateDeltaIndex, stateIndex, inputIndex, algebraicIndex, binaryIndex, timeStepSize, equalityIndex, inequalityIndex) |
Build from an existing tensor + index vectors. All nine arguments are required. |
sys = mdss(Name, Value, ...) |
Nameโvalue form; accepts explicit index vectors or scalar
amountโฆ counts. |
The same model can be parsed from equations with symbolicToMdss,
which builds the matrices for you. Symbolic parameters and their numeric
values are passed inline:
eq = ["xp1 = a*x2*x3"; ...
"xp2 = x1 - b*x2"; ...
"xp3 = c - x1*x2"];
sys = stringParser.symbolicToMdss( ...
eq, 0, ["xp","x","u","y","z"], ...
sym(["a","b","c"]), [0.4, 1.2, 1]);| Property | Description |
|---|---|
mtiTensor |
Model tensor, an mtiTensor (default CPNTensor or TTTensor). |
mtiBase |
The model class mdss currently only supports
0 (monomial base). The construction of models with
1 (literal base) is not yet supported. |
lowerBoundary, upperBoundary |
Per-equation bounds lb โค h โค ub; equal โ equality,
unequal โ inequality. |
timeStepSize |
0 continuous-time, >0 discrete-time
sample time. |
discretizationType |
Method used by c2d/d2d ("none"
if continuous). |
stateName, stateUnit,
algebraicName, algebraicUnit,
inputName, inputUnit, binaryName,
binaryUnit โ string vectors sized to the corresponding
signal count. stateIsOutput,
algebraicIsOutput, binaryIsOutput mark which
signals are outputs. manipulatedVariable,
measuredDisturbance, unmeasuredDisturbance
index the input columns by role.
Set at construction; each maps a matrix row to a signal or equation:
stateDeltaIndex, stateIndex,
inputIndex, algebraicIndex,
binaryIndex (rows of the structure matrix) and
equalityIndex, inequalityIndex (rows of the
parameter matrix). The counts nState, nInput,
nAlgebraic, nBinary, nEquality,
nInequality are derived from them.
Simulate with msim. The full call is
msim(sys, inputTrajectory, inputTime, x0, algebraicGuess, binaryGuess)
and it returns [y, tsim, x, z, tEvents]. The two guesses
are optional; the [] in the call below is the input
trajectory:
t = [0 1000];
x0 = [0.1 0 0];
[~, tsim, x] = msim(sys, [], t, x0);
plot3(x(:,1), x(:,2), x(:,3)); grid oninputTrajectory โ []
means no inputs, i.e.ย an autonomous model. Otherwise pass a
matrix with one row per time sample in inputTime and one
column per input.algebraicGuess โ left out (or
[]) lets the solver find the algebraic variables itself (it
tries both all-zeros and all-ones). Pass a row vector to seed the guess
instead.binaryGuess โ left out (or
[]) lets the solver start from all-zeros and search for a
binary combination until it converges. Pass a row vector to seed
it.For discrete-time models the input time vector must use the modelโs sample time.
| Function | Purpose |
|---|---|
msim |
Simulate the time response to arbitrary inputs. |
symbolicToMdss |
Build an mdss from symbolic/string equations. |
symbolicEquations |
Recover the model as symbolic equations. |
c2d / d2c / d2d |
Discretize, continualize, resample. |
append |
Stack component models diagonally. |
connect |
Connect inputs to signals by name or index. |
jacobian |
Jacobian of the equation system. |
incidenceMatrix |
Structural incidence of equations vs.ย variables. |
linearize |
Linearize around an operating point (LTI/descriptor). |
algebraicElimination |
Remove algebraic equalities/variables while preserving structure. |
normalizeParameterMatrix |
Rescale the parameter matrices. |
trivialReduction |
Drop trivial equations/variables (run automatically by
connect). |
mss ยท msim ยท symbolicToMdss
ยท CPNTensor ยท TTTensor ยท mtiTensor ยท connect ยท append
MyToolbox Documentation | Generated automatically by CI/CD pipeline