# Problem in solving a 16 LMI 21 Var eqn. ,

(Sayyed Mudassir Ali) #1

Here is my code its giving error as
Error – “Subscript indices must either be real positive integers or
logicals”.

Code1:

clc
clear all
close all

n=2;
%A=randn(n);
M=5;
c1=2;c2=3;c3=4;c4=6;
k1=25;k2=30;k3=15;k4=40;

A1=[0 1; -k1/M -c1/M]; A2=[0 1; -k2/M -c2/M];
A3=[0 1; -k3/M -c3/M]; A4=[0 1; -k4/M -c4/M];

A12=A1-A2; A21=A2-A1; A32=A3-A2; A23=A2-A3; A42=A4-A2;
A24=A2-A4; A13=A1-A3; A31=A3-A1;
A41=A4-A1; A14=A1-A4; A43=A4-A3; A34=A3-A4;

B=[1;0];
H=[1;0];C=[1 1]; G=[0;1];

cvx_begin sdp

% Variable of LMIs

variable X1(n,n) symmetric
variable X2(1,n);variable X4(1,n)
variable X3(1,n);variable X5(1,n)
variable X6;variable X7
variable X8;variable X9
variable X10;variable X11
variable X12;variable X13;
variable X14;variable X15;
variable X16; variable X17;
variable X18; variable X20;
variable X19;variable X21;

% LMIs

A1’X1+X1A1 -(C’*X2+X2’*C)<=0
A2’X1+X1A2 -(C’*X3+X3’*C)<=0
A3’X1+X1A3 -(C’*X4+X4’*C)<=0
A4’X1+X1A4 -(C’*X5+X5’*C)<=0

[A2’X1+X1A2-(C’X3+X3’C),X1A12+X7HH’/2;A12’X1+X7HH’/2,-X7HH’]<=0
[A1’X1+X1A1-(C’X2+X2’C),X1A21+X6HH’/2;A21’X1+X6HH’/2,-X6HH’]<=0
%
[A3’X1+X1A3-(C’X4+X4’C),X1A43+X9HH’/2;A43’X1+X9HH’/2,-X9HH’]<=0
[A4’X1+X1A4-(C’X5+X5’C),X1A34+X8HH’/2;A34’X1+X8HH’/2,-X8HH’]<=0
%
[A2’X1+X1A2-(C’X3+X3’C),X1A32+X11GG’/2;A32’X1+X11GG’/2,-X11GG’]<=0
[A3’X1+X1A3-(C’X4+X4’C),X1A23+X10GG’/2;A23’X1+X10GG’/2,-X10GG’]<=0
%
[A1’X1+X1A1-(C’X2+X2’C),X1A41+X13GG’/2;A41’X1+X13GG’/2,-X13GG’]<=0
[A4’X1+X1A4-(C’X5+X5’C),X1A14+X12GG’/2;A14’X1+X12GG’/2,-X12GG’]<=0

[A3’X1+X1A3-(C’X4+X4’C),X1A13+X14HH’/2+X16GG’/2;A13’X1+X14HH’/2+X16GG’/2,-X14HH’-X16GG’]<=0
[A1’X1+X1A1-(C’X2+X2’C),X1A31+X15HH’/2+X17GG’/2;A31’X1+X15HH’/2+X17GG’/2,-X15HH’-X17GG’]<=0

[A4’X1+X1A4-(C’X5+X5’C),X1A24+X18HH’/2+X20GG’/2;A24’X1+X18HH’/2+X20GG’/2,-X18HH’-X20GG’]<=0
[A2’X1+X1A2-(C’X3+X3’C),X1A42+X19HH’/2+X21GG’/2;A42’X1+X19HH’/2+X21GG’/2,-X19HH’-X21GG’]<=0

trace(X1) == 1;

cvx_end

l1=(X2/X1)‘
l2=(X3/X1)’

Problem in Solving LMIs
(Sayyed Mudassir Ali) #2

Can someone please explain me this error ???

Subscript indices must either be real positive integers or
logicals.

Error in cvx_extract (line 552)
Pd(Pr) = false;

Error in cvx_solve (line 26)
[ At, cones, sgn, Q, P, exps, dualized ] = cvx_extract(
shim.config, shim.name );

Error in cvx_finish (line 57)
[ status, result, bound, iters, tol ] = cvx_solve;

Error in cvx_end (line 11)
evalin( ‘caller’, ‘cvx_finish’ );

(Sayyed Mudassir Ali) #3

Can someone please explain me this error??

Subscript indices must either be real positive integers or
logicals.

Error in cvx_extract (line 552)
Pd(Pr) = false;

Error in cvx_solve (line 26)
[ At, cones, sgn, Q, P, exps, dualized ] = cvx_extract(
shim.config, shim.name );

Error in cvx_finish (line 57)
[ status, result, bound, iters, tol ] = cvx_solve;

Error in cvx_end (line 11)
evalin( ‘caller’, ‘cvx_finish’ );

Subscript indices must either be real positive integers or
logicals.

Error in cvx_extract (line 552)
Pd(Pr) = false;

Error in cvx_solve (line 26)
[ At, cones, sgn, Q, P, exps, dualized ] = cvx_extract(
shim.config, shim.name );

Error in cvx_finish (line 57)
[ status, result, bound, iters, tol ] = cvx_solve;

Error in cvx_end (line 11)
evalin( ‘caller’, ‘cvx_finish’ );

(Michael C. Grant) #4

It’s not clear to me why this is occurring, but you may wish to downgrade to CVX 2.1 and try that.

(Sayyed Mudassir Ali) #5

I used 2.1x now but, I got highly elevated outputs. Can you suggest some good solver which could optimize my solution better.

Outputs,
l1 =

1.0e+10 *

``````0.0000
1.6495
``````

l2 =

1.0e+10 *

``````0.0000
1.7793
``````

l3 =

1.0e+10 *

``````0.0000
1.6304
``````

l4 =

1.0e+10 *

``````0.0000
2.1233``````