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

default state-space model block

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

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

enter image description here

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

enter image description here

Now the problem is that,

  1. 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?
  2. 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?
  3. 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

  • $\begingroup$ What do the modal_in blocks do? $\endgroup$ – fibonatic Nov 22 '18 at 19:13
  • $\begingroup$ @fibonatic sorry for messy writing, it's stands for canonic_modal_initial. I forgot to rename it, it's a vector for initial codition x(0) for $\endgroup$ – Unknown123 Nov 22 '18 at 23:41
  • $\begingroup$ doesn't the integrator block have initial conditions as well? $\endgroup$ – fibonatic Nov 22 '18 at 23:44
  • $\begingroup$ I've also been thinking about that, but I'm confused whether it will be initial condition for input or for output of the integrator, xdot(0) or x(0). What we want obviously the x(0) $\endgroup$ – Unknown123 Nov 22 '18 at 23:47
  • $\begingroup$ x(0), see documentation. $\endgroup$ – fibonatic Nov 22 '18 at 23:50

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 & -A_i \\ A_i & A_r \end{bmatrix} \begin{bmatrix} x_r \\ x_i \end{bmatrix}+ \begin{bmatrix} B_r & -B_i \\ B_i & B_r \end{bmatrix} \begin{bmatrix} u_r \\ u_i \end{bmatrix}. $$

The output can be expressed using

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

  • $\begingroup$ The u or input is located inside of Re and Im function. How do you separate it? $\endgroup$ – Unknown123 Dec 16 '18 at 19:22
  • $\begingroup$ @Unknown123 I have updated my answer. $\endgroup$ – fibonatic Dec 16 '18 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.