close all;
clear all;
%%system parameters
A=[-4 -3 0 -1; -3 -7 0 -3; 0 0 -13 -1; -1 -3 -1 -10];
B=[0;-4;2;5];
%% feasible LMI
% Pn=sdpvar(4,4);
% Kn=sdpvar(1,4);
% F1=([-Pn,(A*Pn+B*Kn)';A*Pn+B*Kn,-Pn]<0)+(Pn>0);
% optimize(F1)%mosek
% check(F1)
% Pn=value(Pn);
% Kn=value(Kn);
% Lm1=[-Pn,(A*Pn+B*Kn)';A*Pn+B*Kn,-Pn]
%%infeasible LMI
det=1;
P=sdpvar(4,4);
K=sdpvar(1,4);
F2=(P>eye(4))+([-P,(A+B*K)';A+B*K,det^2*P-2*det*eye(4)]<0);
optimize(F2)%mosek
check(F2)
P=value(P);
K=value(K);
Lm2=[-P,(A+B*K)';A+B*K,det^2*P-2*det*eye(4)]
F1 and F2 are from same problem but obtained by different conversion method. Even through both are LMIs, F1 is OK, F2 is not OK with solution of e1-5 level. I don't know why. If you have more experience on this problem, please tell me. I am very interested about it.