Worked examples shipped with the toolbox, in demo/. Each
entry below has a command you can copy into the MATLAB Command Window —
openDemo followed by the demo’s path. It opens the demo in
the Editor and adds the demo’s folder to your path, so you can press
Run straight away.
The commands work from any current folder: openDemo
finds the demo itself. Most demos are live-script-flavoured
.m files, so the Editor shows their text, equations and
figures inline.
Note: Requirements
Some demos need additional MathWorks products (Simulink, System Identification Toolbox, Optimization Toolbox) or third-party packages. The demo says so at the top when it does.
oneTank/Temperature-controlled water tank, the smallest hybrid example in the toolbox.
A tank losing heat to the ambient, with a hot-water inlet regulated by an on-off (1-point) controller. The controller output is low-pass filtered to prevent Zeno behaviour and drives an inert actuator valve. The system is written as a set of difference equations plus an inequality constraint and built as a hybrid implicit multilinear model. Example from the CoDIT 2024 conference paper.
openDemo oneTank/DemoMTI_oneTankthreeTank/The one-tank example scaled up to three coupled tanks competing for one inlet.
Three water tanks share a single inlet flow and exchange heat with each other and with the environment. Each tank has its own 2-point controller holding its temperature between a lower and an upper bound; when several valves open at once the inlet flow is shared uniformly between them. The model is entered as symbolic equations with inequality constraints and simulated in continuous time.
openDemo threeTank/DemoMTI_threeTanksthreeBodyProblem/Gravitational three-body dynamics as a multilinear model.
The equations of motion of three gravitating bodies are written as string equations and converted into a multilinear model, using auxiliary variables and binary indices to express the inverse-cube distance terms. The demo simulates the resulting trajectories; a recorded animation of the result ships alongside it.
openDemo threeBodyProblem/DemoMTI_threeBodyProblemIFAC_hybridSystems/The examples accompanying the IFAC Nonlinear Analysis: Hybrid Systems 2026 contribution.
Starts from an ideally-mixed water tank whose temperature is the single state, driven by inlet flow, inlet temperature, ambient temperature and an electrical heating coil, and builds it as an explicit multilinear model from its structure and parameter matrices. Further examples in the same script extend it towards hybrid, level-controlled behaviour.
openDemo IFAC_hybridSystems/DemoMTI_hybridSystemsTankExamplesDemo_BooleanIndexMTI/A subclass of MTI models whose state space grows logarithmically with the number of signals.
Boolean-index MTI models enable the representation of up to
signals by a model of order
through binary encoding of the signal graph. The demo walks the full
construction chain — signal graph, binary-encoded automaton, next-state
OTVL, solution subset, structure and parameter matrices of an
mss model — on a multi-energy system whose four measured
signals become a two-state model.
openDemo Demo_BooleanIndexMTI/DemoMTI_Boolean_Index_MTIstochasticAutomata/Stochastic automata expressed in multilinear form.
Builds a stochastic automaton with 25 states, 27 inputs and 5 outputs from stored transition data, assembling the sparse structure matrix that represents its transition probabilities. Example from the IFAC World Congress 2026 contribution on multilinear modelling with the MTI Toolbox.
openDemo stochasticAutomata/DemoMTI_stochasticAutomataSimulationmss2mss_literal2monomialBase/Converting a multilinear model between its two tensor bases while keeping the input-output behavior.
Converts an mss model from the literal base to the
monomial base and back again with mss2mss, showing how the
structure matrix encodes the equations in each base.
openDemo mss2mss_literal2monomialBase/DemoMTI_literalBase2monomialBasemlinearize_demo/Approximating an existing nonlinear Simulink model by a multilinear one.
Approximates a nonlinear Simulink model of a continuous stirred-tank
reactor — four states, two inputs — by an explicit multilinear
(mss) model, using the sparse-grid interpolation performed
by mlinearize. The multilinear model is then simulated with
msim and compared against the original nonlinear model over
the same input trajectory. Needs Simulink and the Sparse Grids MATLAB
Kit.
openDemo mlinearize_demo/DemoMTI_mlinearizemlgreyest_example/Estimating multilinear models from data with
mlgreyest.
Identifies the parameter matrix of a multilinear model when its structure matrix is already known, comparing the estimate against the parameter matrix the data was generated from.
openDemo mlgreyest_example/DemoMTI_system_identificationPhiEstimates a discrete-time multilinear model of a test room from measured building data, using the alternating least-squares method with a rank-4 parameter tensor. The identified model is validated by simulation against a held-out part of the measurement record.
openDemo mlgreyest_example/DemoMTI_system_identification_AlsThe same test-room identification problem solved by nonlinear
optimization (fmincon) with a rank-2 parameter tensor and
four inputs, again validated against held-out data.
openDemo mlgreyest_example/DemoMTI_system_identification_nonlinEKF_demo/Extended Kalman filtering on a multilinear model.
Runs an Extended Kalman Filter for state estimation on a multilinear
representation of the chaotic Lorenz attractor, scoring the filter
against the trajectory that generated the measurements and keeping the
covariance update symmetric positive semidefinite throughout. Two
prediction steps are available — a local fixed-step Dormand-Prince step
and msim with adaptive step control — and the demo measures
what each one costs. Shows how the toolbox’s Jacobian and output
evaluation functions are used inside an estimator.
openDemo EKF_demo/DemoMTI_EKFMHE_demo/Large-scale state and disturbance estimation by successive affine linearization.
Estimates 200 states and 100 unmeasured disturbance inputs of a
closed-loop chain of 100 Van der Pol oscillators from the measured
outputs. Each oscillator is an implicit MTI (mdss) model
taking the previous oscillator’s output plus an unknown disturbance,
with the last oscillator fed back to the first. The estimator starts as
an Extended Kalman Filter and switches to the moving horizon estimator
once enough measurements are available. Companion to the IFAC 2026
contribution.
openDemo MHE_demo/DemoMTI_MHE_VanDePolHVAC/Component-based modelling of a full air-conditioning plant.
A constant-air-volume partial air-conditioning plant supplying a production space: mixing chamber with heat recovery, preheater, cooler with dehumidification modelled as a four-cell heat exchanger, reheater, supply and exhaust fans, and a PLC unit with saturated PI controllers and anti-windup feedback. Each component is built as its own submodel in a separate script and the plant is assembled from them, demonstrating component-based hybrid implicit-MTI modelling.
openDemo HVAC/DemoMTI_AirConditioningSystemDistrictHeatingNetworks/Thermo-hydraulic pipe networks, and exact model reduction on them.
Builds a single district-heating pipe as a chain of finite-volume
segments, each carrying a mass flow, a pressure and a temperature,
driven by a constant inlet flow with a +30 K step on the inlet
temperature. The resulting MTI model is reduced with
algebraicElimination and the reduced model is checked to
reproduce the states and outputs of the original.
openDemo DistrictHeatingNetworks/DemoMTI_Discretized_Single_pipeAssembles a small branched district-heating network from individual
pipes and junctions, simulates it against measured input data from the
AIT test rig, then applies algebraicElimination and
compares the outlet temperatures of the original and reduced models to
confirm the reduction is exact.
openDemo DistrictHeatingNetworks/DemoMTI_DHN_PongaumELY_mpc/Supervisory model predictive control of a multi-stack PEM electrolyzer.
A multi-stack PEM electrolyzer powered by a variable power profile is controlled by a two-stage nonlinear MPC built on an implicit MTI model of all stacks. Stage 1 decides which stacks run, relaxing the on/off signals to continuous variables and quantizing them afterwards; stage 2 allocates power among the running stacks. The result is compared against the classic Daisy Chain and Equal rule-based allocation strategies. This main file drives the whole chain. Companion to the paper: Aline Luxa, Richard Hanke-Rauschenbach, Gerwald Lichtenberg: Model predictive supervisory control for multi-stack electrolyzers using multilinear modeling, International Journal of Hydrogen Energy, Volume 185, 2025, 151847, ISSN 0360-3199, https://doi.org/10.1016/j.ijhydene.2025.151847.
openDemo mELY_mpc/DemoMTI_mELY_sup_controlPowerSystems/Converter-dominated grids: modelling, simulation and small-signal stability analysis.
Models a nonlinear synchronous-reference-frame phase-locked loop as a second-order multilinear model derived with trigonometric identities, then simulates it and compares the response against the nonlinear model.
openDemo PowerSystems/PhaseLockedLoop/DemoMTI_powerSystemsDemoPLLAn essential system — a grid-following converter, a grid-forming converter and a load on a Thévenin-equivalent grid. Operating points are initialized from the nonlinear Simulink model, an implicit MTI model is built and its Jacobian formed to give a linear descriptor state-space model, and stability is assessed from the generalized eigenvalues. The nonlinear, multilinear and linear descriptor responses are then compared, along with the computational cost of each.
openDemo PowerSystems/SmallSignalAnalysis/DemoMTI_powerSystemThreeBusSSATakes the essential system of the small-signal analysis demo and
multilinearizes the nonlinear part of the grid-following converter with
mlinearize, producing an mss object that is
brought back into the Simulink model through an S-function block. The
bounds of the operating region are taken from the nonlinear
simulation.
openDemo PowerSystems/MultilinearizeGFLcontrol/DemoMTI_mlinearizeGFLA nine-bus converter-based power network with grid-forming
droop-controlled voltage source converters, written symbolically and
converted into an implicit multilinear (mdss) model, with
its response compared against the corresponding nonlinear model. The
demo can either build the models symbolically or load previously built
ones from disk.
openDemo PowerSystems/InverterBasedNetwork/DemoMTI_inverter_nine_busThe WSCC nine-bus system — one synchronous generator, one grid-forming and one grid-following converter — built as an MTI model directly from its Excel case files. The demo walks the complete workflow: model construction in both qd and abc coordinates, small-signal analysis (linearization at the operating point, eigenvalues, mode table, participation factors), and time-domain simulation of a load step. Every result is compared against the STAMP tool, whose linear state-space model is the small-signal reference and whose nonlinear Simulink model is the time-domain reference.
openDemo PowerSystems/NineBusNetwork/DemoMTI_powerSystemNineBusExpert companion to the demo above: it runs the same workflow and
profiles the execution time of every step in both tool chains, reporting
per-step wall times and model sizes (states, inputs, algebraic
variables, sparsity, Simulink block count, file sizes). It also compares
the cost of the two eigenvalue problems — STAMP’s standard
eig(A) against the descriptor model’s generalized
eig(A, E), which additionally carries the algebraic
variables.
openDemo PowerSystems/NineBusNetwork/DemoMTI_powerSystemNineBusProfilerIdentifies a multilinear model of the nonlinear subsystem of a
grid-forming converter, isolated from a one-bus grid made up of a
nonlinear diesel synchronous generator and a ZIP load. The subsystem is
first multilinearized with mlinearize over bounds taken
from the nonlinear simulation, which gives the structure matrix;
mlgreyest then estimates the parameter matrix from
normalized input and state data, using the first 70 % of the record for
training. The identified model is simulated over the full record and its
states compared against the nonlinear ones, before and after rescaling.
Needs Simulink, the System Identification Toolbox and the Sparse Grids
MATLAB Kit. The inverter grid model was provided by Prof. Byungkwon Park
and colleagues at Soongsil University, Seoul, South Korea, and is
described in Wong et al., 2026.
openDemo PowerSystems/SysIDGFMinverter/DemoMTI_greyestGFMMyToolbox Documentation | Generated automatically by CI/CD pipeline