Which term is incorrect with dimension?


(eliiiiiiiiiiiiiiiii) #1

Hi ,
I have this program but it take errors on dimensions:

clear all
close all
clc
%% data of system
A =[2 3 .6;-4 2 1;1 2.5 -.9]
Ad =[1 .4 2;-2 -.5 1;2 1 -1]
B =[1;-2;1]
C =[1 0 3]
Plant = ss(A,B,C,0,.1)
n =size(A,1);
[n,m] =size(B);
[q,n] =size(C);
figure()
pzmap(Plant)
mu1 = 0.8 ;mu2 = 0.9;
d1=2;d2=3;
tau1=2;tau2=5;
tau3 =3;tau4 = 6
cvx_begin sdp

variable Ps(n,n)  symmetric;
variable Pc(n,n)  symmetric;
variable Pst(m,m) symmetric;
variable Pct(m,m) symmetric;

variable R(2*n,2*n)  symmetric;
variable Q(2*n,2*n)  symmetric;
variable S(2*n,2*n)  symmetric;
variable X(2*n,2*n)  symmetric;

variable T(n,n)
variable L(n,m)
variable N(q,n)
variable G(q,m)

variable gamasq nonnegative;

P  = [Ps zeros(n);zeros(n) Pc]
PT = [Pst zeros(m);zeros(m) Pct]
Y = -P+(tau2-tau1+1)*R+(d2-d1+1)*Q+(tau4-tau3+1)*S+(tau4+tau2-tau1-tau3+1)*X;

[zeros(1) Pst zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) N zeros(1,n) zeros(1,n) mu2*G*C zeros(1,n) Pst zeros(1) mu2*G;
Pst' eye(1) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) Pst*C zeros(1,n) zeros(1,n) zeros(1,n) zeros(1) Pst zeros(1);
zeros(n,1) zeros(n,1) -Ps zeros(n) Ps*A zeros(n) Ps*Ad zeros(n) zeros(n) mu1*B*N zeros(n) zeros(n) mu1*mu2*B*G*C zeros(n) zeros(n,1) mu1*Ps*B mu1*mu2*B*G;
zeros(n,1) zeros(n,1) zeros(n) -Pc zeros(n) T zeros(n) zeros(n) zeros(n) zeros(n) mu2*L*C zeros(n) zeros(n) zeros(n) mu2*L zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) (Ps*A)' zeros(n) Y(1:3,1:3) Y(1:3,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) zeros(n) T' Y(4:6,1:3) Y(4:6,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) (Ps*Ad)' zeros(n) zeros(n) zeros(n) -Q(1:3,1:3) -Q(1:3,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) zeros(n) zeros(n) zeros(n) zeros(n) -Q(4:6,1:3) -Q(4:6,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -R(1:3,1:3) -R(1:3,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
N' zeros(n,1) (mu1*B*N)' zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -R(4:6,1:3) -R(4:6,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) (Pst*C)' zeros(n) (mu2*L*C)' zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -S(1:3,1:3) -S(1:3,4:6) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -S(4:6,1:3) -S(4:6,4:6) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1);
(mu2*G*C)' zeros(n,1) (mu1*mu2*B*G*C)' zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -X(1:3,1:3) -X(1:3,4:6) zeros(n,1) zeros(n,1) zeros(n,1);
zeros(n,1) zeros(n,1) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) -X(4:6,1:3) -X(4:6,4:6) zeros(n,1) zeros(n,1) zeros(n,1);
Pst' zeros(1) zeros(1,n) mu2*L' zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) -gamasq*eye(1) zeros(1) zeros(1);
zeros(1) Pst' (mu1*Ps*B)' zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1) eye(1) zeros(1);
(mu2*G)' zeros(1) (mu1*mu2*B*G)' zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1,n) zeros(1) zeros(1) eye(1)]<=0

cvx_end

(Mark L. Stone) #2
>> [zeros(n,1) zeros(n,1) (Ps*Ad)' zeros(n) zeros(n) zeros(n) -Q(1:3,1:3) -Q(1:3,4:6) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n) zeros(n,1) zeros(n,1) zeros(n,1)]
ans =
    cvx real affine expression (3x38 matrix, 27 nonzeros)

The preceding block rows have 41 columns. Perhaps there are other offending rows as well. You can check this as easily as I can.