# Arithmetic Operations on Matrix Signals

This example shows how to perform arithmetic operations on signals carrying matrix and vector data.

In this example, the model performs a series of matrix operations on the input matrices and vectors to transform a system with state-space representation to its controllable canonical form, also known as phase variable form. The phase variable form provides a simplified representation of the system that eases the controllability analysis and helps in model reduction.

The canonicalform model contains the following components that show different mathematical operations.

• Input data

• Multiplication

• Inverse

• Canonical Form

Open the model.

open_system('canonicalform.slx')

### Input Data

The Input data component represents the input matrix and vectors in state-space form.

$\underset{}{\overset{˙}{x}}=Ax+Bu$

$y=Cx+Du$

In this example, $A$ is 3-by-3 matrix that represents the system, $B$ is 3-by-1 input vector, $C$ is 3-by-1 output vector, and the model assumes $D$ to be 0.

### Multiplication

The controllability matrix for the state-space system is defined as:

$Q=\left[B\phantom{\rule{0.5em}{0ex}}AB\phantom{\rule{0.5em}{0ex}}{A}^{2}B.....{A}^{n-1}B\right]$, where n represents the number of states.

The Multiplication component computes the controllability matrix Q from the state-space system.

### Controllable Canonical Form

The model modifies the state-space equation using the substitution $x={P}^{-1}z$ and $D=0$ as:

$\underset{}{\overset{˙}{z}}=PA{P}^{-1}z+PBu$

$y=C{P}^{-1}z$

In these equations, $P=\left[{P}_{1}\phantom{\rule{0.5em}{0ex}}{P}_{1}A\phantom{\rule{0.5em}{0ex}}{P}_{1}{A}^{2}\right]$, where ${P}_{1}$ is the last row of ${Q}_{inv}$. The Inverse component computes the inverse of the controllability matrix Q and transformation matrix P.

The equation is further simplified as:

$\underset{}{\overset{˙}{z}}={A}_{0}+{B}_{0}u$

$y={C}_{0}z$

where ${A}_{0}=PA{P}^{-1}$, ${B}_{0}=PB$, and ${C}_{0}=C{P}^{-1}$ .

The Canonical Form component computes the canonical form of the state-space system.

Simulate the model and visualize ${A}_{0}$, ${B}_{0}$, ${C}_{0}$ using Display blocks.

sim('canonicalform.slx');