Why it can find a feasibility solution using built-in Matlab toolbox , but it can not be solved using by YALMIP?

76 views
Skip to first unread message

SHANZHI LEE

unread,
Apr 4, 2016, 8:57:10 AM4/4/16
to YALMIP
Hi Johan
    I try to solve the following Linear Matrix Inequality using YALMIP. 
The matrixes P, K,Y are unknown varablies. Others  are constant.  When I try to find a feasibility solution by the YALMIP toolbox, the results are  

>>  Y =   1.0e+12 *   [    NaN    1.0171;
       NaN    0.0000;
       NaN    0.2751;
       NaN    0.0000;
       NaN    0.3116];

The first colum value  of Y are NaN. 

However , if i use  self toolbox to solve these LMI, it gives me a solution.  And the Y,K, and P are explicit value.
Y=   1.0e-05 *[         0         0;   
      0         0;    
      0         0;      
      0   -0.8134;   
      0         0];

 I donot know why it makes difference.  In the former, why  did the result return  a NaN value?  Where i can change in the  code for eliminating the NaN value in the YALMIP? Can you help me?

The code is 
//{ 

A = 1.0e+04 * [       0    0.0001   -0.0000         0         0;
   -0.0022   -0.0000    0.0000         0         0;
    1.6744    0.0120   -0.0001         0   -0.0000;
         0         0         0   -0.0010         0;
         0         0         0         0   -0.0010];

B = [  0     0     0    10     0;
       0     0     0     0    10]';
C = [ 0     1     0     0     0;
      0     0     0     1     0];
D = [     0   100     0     0     0]';

CD1=inv((C*D)'*(C*D))*(C*D)';
U=-D*CD1;
V=eye(2)-C*D*CD1;



%% step 1 calculate U V
CD1=inv((C*D)'*(C*D))*(C*D)';
U=-D*CD1;
V=eye(2)-C*D*CD1;

%% step2  Y K P
setlmis([])
nU=size(U);
nV=size(V);
n1=nU(1,1);
n2=nV(1,1);
I=eye(n1);
n1=5;
n2=2;
Y1=lmivar(2,[n1,n2]);
K1=lmivar(2,[n1,n2]);
P=lmivar(1,[n1,0]);
gam=10000;
t1=sqrt(gam);
  lmiterm([1 1 1 P],((I+U*C)*A)',1,'s');          % LMI #1: ((I+U*C)*A)'*P+P*((I+U*C)*A)
  lmiterm([1 1 1 -Y1],.5*(V*C*A)',1,'s');         % LMI #1: (V*C*A)'*Y1' (NON SYMMETRIC?)
  lmiterm([1 1 1 Y1],.5*1,V*C*A,'s');             % LMI #1: Y1*V*C*A (NON SYMMETRIC?)
  lmiterm([1 1 1 -K1],.5*C',-1,'s');              % LMI #1: -C'*K1'* (NON SYMMETRIC?)
  lmiterm([1 1 1 K1],.5*1,-C,'s');                % LMI #1: -K1*C (NON SYMMETRIC?)
  lmiterm([1 1 1 0],gam.*I);                      % LMI #1: gam.*I

  lmiterm([1 1 2 Y1],1,t1.*V*C); 
  lmiterm([1 1 2 P],1,t1.*(I+U*C)); 
  lmiterm([1 2 2 0],-I);                          % LMI #1: -I

  lmiterm([-2 1 1 P],1,1);                        % LMI #2: P

  lmi_o1=getlmis;
[tmin,xfeas]=feasp(lmi_o1)
Y1t=dec2mat(lmi_o1,xfeas,Y1)
K1t=dec2mat(lmi_o1,xfeas,K1)
Pt=dec2mat(lmi_o1,xfeas,P)


%% YALMIP
%%-------------------------------------------------------
gam=10000;
% step 1 calculate U V
CD1=inv((C*D)'*(C*D))*(C*D)';
U=-D*CD1;
V=eye(2)-C*D*CD1;
nU=size(U);
nV=size(V);
n1=nU(1,1);
n2=nV(1,1);
I=eye(n1);
n1=5;
n2=2;
Y1=sdpvar(n1,n2);
K1=sdpvar(n1,n2);
P=sdpvar(n1,n1);
t1=sqrt(gam);
S11=A'*(I+U*C)'*P+(V*C*A)'*Y1'-C'*K1'+P*(I*+U*C)*A+Y1*V*C*A-K1*C+gam*I;
S12=t1*P*(I+U*C)+t1*Y1*V*C;
S22=-I;
F=[P>0];
F=[F,[S11, S12; S12' S22]<0];
solvesdp(F);

Y=inv(value(P))*value(Y1);
K=inv(value(P))*value(K1);

}

















CompareMatlab_and_Yalmip.m

Johan Löfberg

unread,
Apr 4, 2016, 9:01:33 AM4/4/16
to YALMIP
Have you actually read what LMILAB tells you about your model (that you solve using lmiterm etc)?

and when it comes to YALMIP+lmilab:
Reply all
Reply to author
Forward
0 new messages