Utility function.
Generate a random multilinear state-space (mss) model.
Source: src/rmss.m
rmss builds a random explicit multilinear state-space
model of a requested size — n states, m
inputs, p outputs and rank r — handy for
tests, examples and scaling benchmarks. The result is a continuous-time
mss by default, or a
discrete-time one when a positive time step is given (the former
drmss).
The model tensor is drawn and assembled by CPNTensor.randCpn;
rmss wraps it in an mss with the matching
index vectors.
The model is a rank-2r CPNTensor wrapped as
an mss, laid out in a fixed order:
| Rows / columns | Assignment |
|---|---|
structure rows 1..n |
states |
structure rows n+1..n+m |
inputs |
parameter rows 1..n |
state equations |
parameter rows n+1..n+p |
output equations |
columns 1..r |
state-equation monomials |
columns r+1..2r |
output-equation monomials |
The state and output equations get separate
monomials — the output block is given its own structure rather than
reusing the state monomials — so the model carries a full output
structure. See CPNTensor.randCpn
for the tensor layout, the per-block sparsity and the size rationale
behind it.
The model is in the monomial base with no False factors:
structure entries equal to 1 are True and
every other nonzero is Continuous.
For a fixed rng seed the model is reproducible.
| Argument | Description |
|---|---|
n |
Number of states. Defaults to a positive random integer,
max(1, round(abs(10*randn))). |
m |
Number of inputs. Default 1. |
p |
Number of outputs. Default 1. |
r |
Rank of each equation block; the model tensor has rank
2r. Default round((n+m)/2). |
ts |
Time step size. Default 0 (continuous-time).
ts > 0 gives a discrete-time model. |
Note the argument order n, m, p, r, ts
here — the number of inputs m comes before the number of
outputs p, the opposite of CPNTensor.randCpn.
| Output | Description |
|---|---|
msys |
Random mss model of
the requested size. |
msys = rmss(n)
msys = rmss(n, m, p)
msys = rmss(n, m, p, r)
msys = rmss(n, m, p, r, ts)% n=4 states, m=1 input, p=1 output, rank r=6
msys = rmss(4, 1, 1, 6);% same size, sampled at ts = 0.1
msys = rmss(4, 1, 1, 6, 0.1);mss · CPNTensor.randCpn
· msim · ss2mss · mlgreyest
MyToolbox Documentation | Generated automatically by CI/CD pipeline