MATLAB: How to simulate a complex-valued space state system in simulink or by command

lsimsimulink

I have a complex-valued discrete space-state LTI system, where A belongs to C^n space and B,C,D to the R^n space, I need to simulate its response and I have tried to use lsim to do it, but it says it has problems with complex values as well as in simulink.
Someone has asked this question before and he has been recommended to use ltitr command, I have tried to use but inmediatly it says that "Matrix dimensions must agree". My matrices are,
I have a closed loop matrix (phi_clamp) which I construct by using a controller which is [XOUT 0]; and then I construct my space-state system which I need to simulate (sys_clamp).
phi_clamp=phiamp+gammaamp*[XOUT 0];
sys_clamp=ss(phi_clamp,gammaamp,Cc,Dd,h);% needs to be simulated
sys_clamp =
a =
x1 x2 x3
x1 0.364-0.0489i 0.771+0.0254i 0.00995
x2 -1.28-0.0988i 0.538+0.0514i 0.01
x3 -1.3-0.0998i -0.467+0.0519i 0
b =
u1
x1 0.49
x2 0.99
x3 1
c =
x1 x2 x3
y1 1 0 0
d =
u1
y1 0
Sample time: 1 seconds
Discrete-time state-space model.
By other hand to simulate with ltitr command what I have done is:
Xsim=ltitr(phi_clamp,gammaamp,U);
and I have use an U which is
t=0:h:50;
U=0.5*square(t/10,50)
because it says that it should be ltitr(A,B,U), but it says that "Matrix dimensions must agree". So what is wrong?
To simulate via simulink I have used a discrete space-state block with phiamp, gammaamp, C and D and my controller as a gain, it shows problems inside the block because of the complex values, the question here is should I change a parameter of the block or a simulation parameter, or what?

Best Answer

a=[ 0.364-0.0489i 0.771+0.0254i 0.00995
-1.28-0.0988i 0.538+0.0514i 0.01
-1.3-0.0998i -0.467+0.0519i 0]
b=[0.49;0.99;1]
c=[1 0 0]
d=0
t=0:h:50;
U=0.5*square(t/10,50)'
xsim=ltitr(a,b,U)
U should be a column vector
Or, you can also use lsim
system1=ss(a,b,c,d,1)
[output,time,state2]=lsim(system1,U,t)