Static method of mss.
Approximate a nonlinear Simulink model by an explicit MTI
(mss) model, sampled on a sparse grid.
Source: src/model/@mss/mlinearize.m
mlinearize computes an explicit multilinear
time-invariant state-space (mss) approximation of a
nonlinear Simulink model over a prescribed operating domain.
The nonlinear model is assumed to be of the form
where
denotes the state vector,
the input vector, and
the output vector of Simulink model. The function returns an
mss object
where the state evolution is valid for both continuous-time or discrete-time of the original Simulink model.
The approximation is constructed over a bounded operating region specified by lower and upper bounds for the states, inputs, and outputs.
where the state variables must follow the ordering used internally by
Simulink (reported by mlinearize after execution).
The function computes the coefficients of the tensors and following the method described in [1]. f For continuous-time models, this requires sampling and numerically integrating the model equations over a grid of operating points over the specified domain. For discrete-time models, only the former is needed.
The grid is constructed using sparse-grid interpolation [2], which is also used to efficiently perform the numerical integrations. The interpolation level, denoted by controls both the number of grid points and the integration accuracy. The number of interpolation points grows polynomially with as
where is the number of states and is the number of inputs.
Only monomials whose multilinear order is less than or equal to the
specified max_order are retained. The retained monomials
define the structure of the resulting multilinear model, as illustrated
below.
Let
be a vector of variables . The multilinear monomial basis
contains monomials, with , and is the Kronecker product. Each its -th entry, i.e. one monomial.
Consider ordering the monomials generated by the recursive construction
This ordering induces a structured pattern in the exponent vectors of the monomials, i.e. a vector with the order of each element in .
Let be the exponent matrix, where the -th column corresponds to the exponent vector of the monomial at position .
For example with , the monomial ordering is
so that , and , and the exponent matrix is
Here, switches every monomial, every monomials, and every monomials.
For variable , its exponent switches every monomials. The exponent matrix is computed as
Equivalently, variable is present in blocks of length , alternating between absence and presence as increases.
The multilinear order of a monomial is the number of variables it contains, which in this encoding is simply the column sum of the exponent matrix,
The argument max_order
keeps only the monomials up to that order,
which leads to the reduced exponent matrix
This is exactly the structure matrix
of the returned mss object.
Choosing
retains the full basis of
monomials (values above
are capped to
with a warning), so max_order trades approximation quality
against model size.
Retained monomials whose coefficients all turn out to be zero are
dropped afterwards by trivialReduction,
so the rank of the returned model is usually smaller still.
In mlinearize the variables of the basis are the states
and inputs together,
so is the of the model above, and the exponent matrix has one row per state and per input, in that order.
The sparse grid lives on , so each variable is first mapped onto that cube by the affine scaling built from the operating bounds,
which is why the bounds may not be degenerate: makes singular. The outputs are scaled the same way, from their own bounds.
The computation of the coefficients in and is done on the scaled variables , and the coefficients are mapped back to physical units as the last step.
Continuous/discrete hybrid models are not supported. The model must be either entirely continuous-time or entirely discrete-time. Mixed models containing both continuous and discrete dynamics cannot be multilinearized.
Simscape models are not supported. Only models constructed from
standard Simulink blocks are compatible with
mlinearize.
Accelerator and Rapid Accelerator simulation modes are not supported. The multilinearization procedure repeatedly modifies model parameters and performs a large number of simulations. Therefore, the Simulink model must be executed in Normal simulation mode.
The function requires the Sparse Grids MATLAB Kit, which builds the sparse grid it samples on.
The kit is not part of the MTI-Toolbox. It is a
separate package by L. Tamellini, F. Nobile and C. Piazzola, licensed
BSD-2-Clause, and it is redistributed unmodified inside the toolbox —
release 23.05 (“Robert”), under
externalTools/sparse-grids-matlab-kit/, with its own
LICENSE.txt beside it. An installed toolbox puts it on the
MATLAB path, so mlinearize works with no download and no
network. Running from a source checkout instead, add it to the path
yourself.
It is bundled rather than fetched on your behalf, so nothing is
installed silently and the capability does not depend on an external
hosting link staying alive. It can still be deleted from an installed
tree, which is why environmentChecker
probes for it rather than assuming it.
The kit’s authors ask to be cited: the package webpage, https://sites.google.com/view/sparse-grids-kit/home,
together with reference [2] below. Please do both if you publish work
that used mlinearize.
| Argument | Description |
|---|---|
model |
Name of the Simulink model to approximate, as a string or character vector. |
low_bnd |
Lower bounds of the operating domain:
elements, ordered
.
The states follow Simulink’s internal ordering, which
mlinearize prints when it runs. |
up_bnd |
Upper bounds, with the same length and ordering as
low_bnd. Every entry must differ from its
low_bnd counterpart: a zero-width interval makes the
scaling singular and raises
mlinearize:degenerateBound. |
level |
Sparse-grid interpolation level . The number of interpolation points grows as . |
max_order |
Maximum multilinear order of the approximation. Only monomials of order are retained; values above are capped to it with a warning. |
tolerance |
(optional) Coefficient cut-off. Entries of and smaller than this in magnitude are set to zero before the model is assembled. |
| Output | Description |
|---|---|
msys |
Explicit multilinear approximation of the Simulink model, as an mss object. Continuous-time
(timeStepSize = 0) or discrete-time
(timeStepSize equal to the model’s sample time), matching
the source model. |
msys = mss.mlinearize(model,low_bnd,up_bnd,level,max_order)
msys = mss.mlinearize(model,low_bnd,up_bnd,level,max_order,tolerance)Kruppa, K., Pangalos, G., and Lichtenberg, G. Multilinear approximation of nonlinear state-space models. IFAC Proceedings Volumes, 47(3):9474–9479, 2014.
Piazzola, C., and Tamellini, L. The Sparse Grids Matlab kit — a Matlab implementation of sparse grids for high-dimensional function approximation and uncertainty quantification. 2023. Package webpage: https://sites.google.com/view/sparse-grids-kit/home (check it for the most up-to-date citation data).
MyToolbox Documentation | Generated automatically by CI/CD pipeline