Comupting the Jacobian matrix

This demo showcases the computation of the Jacobian matrix of randomn continuous-value, continuous-time explicit multilinear model of type norm1CPN. The outlined demo is based on the paper [1].
Open Live Script in Matlab
Table of Contents

Small system example

Generating a random explicit MTI model

Create a random third-order explicit continuous-time MTI model with one input and no output. The rank of the CP-decomposed MTI model in the 1-norm format is set to 3. Then create a random MTI state-space model using rmss.
n=3; % number of states
m=1; % Number of inputs
p=0; % number of outputs
r=3; % rank
msys=rmss(n,m,p,r); % creates a random multilinear model of class mss

Display system of equations

If the Symbolic Math Toolbox from Matlab is installed, you can uncomment the following section to display the generated model we can use symbolicEquations:
% [xp,y]=symbolicEquations(msys);
% sympref('FloatingPointOutput',true); % Display of symbolic values to 4 decimal points
% expand(xp)

Generate the operating point

Assume we have the operating point of 1 for all states and inputs.
x_op=ones(n,1); % operating point x
u_op=ones(m,1); % operating point u
xop=[x_op(:);u_op(:)]; % operating point of state and input variables

Compute the Jacobian matrix

Before we can compute the Jacobian, we need to transform the mss-object into norm1CPN object. If you want to linearize a mss object to get a linear state-space model as an ss-object, you can do this using the linearize() command. Here we focus on just the Jacobian of a norm1CPN-object.
obj=CPN1(msys.F.U,msys.F.phi); % creating a multilinear model as norm1CPN class object
Then we can compute the Jacobian matrix by:
J=jacobian(obj,xop)
J =
(2,1) 0.0920 (3,2) 0.0448 (2,3) 0.0629 (1,4) 0.2023

Large system example

The same can be done for large systems.

System parameters

n=2e4; % number of states
r=1e1; % rank
m=0; % Number of inputs
p=1; % number of outputs

Creating randomized sparse MTI model

msys=rmss(n,m,p,r); % creates a random multilinear model of class mss

Generate the operating point

x_op=rand(n,1); % operating point x
u_op=rand(m,1); % operating point u
xop=[x_op(:);u_op(:)]; % operating point of state and input variables

Compute the Jacobian

obj=CPN1(msys.F.U,msys.F.phi); % creating a multilinear model as norm1CPN class object
J=jacobian(obj,xop);
 

References

[1] Christoph Kaufmann, Diego Crespí de Valldaura Garcia, Gerwald Lichtenberg, Georg Pangalos, and Carlos Cateriano Yáñez, "Efficient Linearization of Explicit Multilinear Systems using Normalized Decomposed Tensors", IFAC World Congress 2023, DOI: 10.1016/j.ifacol.2023.10.344