How to model state space for complex valued system correctly in SIMULINK (MATLAB)? When trying to use the default state-space model block, if there is a complex number valued in the matrices, there will be an error





To resolve that, firstly I need to look at pseudo reference model of state space on the internet


Then, create my own state-space block as a new subsystem



u is for input
y is for output
x is the state variable as an output (for sensing use, such as full state feedback)

And here is the inside





Now the problem is that,


The IC (Initial Condition) block cannot simulate what lsim
can done in matlab code, there must be an exponential decay expected
result for the unforced solution, but what I've got is that the
initial condition only happened at the exact t=0 and there is
no exponential decay.  How do I solve it?
The Integrator and IC block cannot operate with complex valued 
number, the input and must be separated manually into real and imaginary 
part or magnitude and phase part and then joined together again. Is there
any better way to operate them with complex valued number in simulink?
The gain block of A, B, C, and D matrix look ugly, I haven't been
able to change it in the shape of rectangle box as my reference
model above. Is there any way to change it?


Finally, if there is any better solution for my problem, such as pre-builtin complex valued state-space model, or better subsystem, I would be happy to know it
You can split up the real and imaginary part of the state into their own seperate states. Namely by defining $x_r=\mathrm{Re}(x)$, $x_i=\mathrm{Im}(x)$, $A_r=\mathrm{Re}(A)$, $A_i=\mathrm{Im}(A)$, $u_r=\mathrm{Re}(u)$, $u_i=\mathrm{Im}(u)$, $B_r=\mathrm{Re}(B)$ and $B_i=\mathrm{Im}(B)$ then the differential equation can also be written as

$$
\dot{x}_r+i\,\dot{x}_i=(A_r+i\,A_i)(x_r+i\,x_i)+(B_r+i\,B_i)(u_r+i\,u_i)
$$

which when split into their real and imaginary part gives

$$
\begin{bmatrix}
\dot{x}_r \\ \dot{x}_i
\end{bmatrix}=
\begin{bmatrix}
A_r &amp; -A_i \\
A_i &amp; A_r
\end{bmatrix}
\begin{bmatrix}
x_r \\ x_i
\end{bmatrix}+
\begin{bmatrix}
B_r &amp; -B_i \\
B_i &amp; B_r
\end{bmatrix}
\begin{bmatrix}
u_r \\ u_i
\end{bmatrix}.
$$

The output can be expressed using

$$
y=C\begin{bmatrix}
I &amp; i\,I
\end{bmatrix}
\begin{bmatrix}
x_r \\ x_i
\end{bmatrix} + D\begin{bmatrix}
I &amp; i\,I
\end{bmatrix}
\begin{bmatrix}
u_r \\ u_i
\end{bmatrix}.
$$