clear all;close all;clc
mu=0.00004;
lamuta1=0.2;
lamuta2=0.9;
h1=0;
h2=0.5;
h12=h2-h1;
hs=(h2*h2-h1*h1)/2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
k11=-0.932;
k22=-0.231;
I6=eye(6);
A=[0 1;-1 -2];
E=[0 1;-1 1];
M=[0 1;-1 -2];
B=[0.2;0.1];
D=0.2;
C=[-1 0];
K=[k11;k22];
I3=eye(3);
I2=eye(2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ahua11=1;
Ahua12=0;
Ahua13=0;
Ahua21=1;
Ahua22=1;
Ahua23=0;
Ahua31=0;
Ahua32=0;
Ahua33=1;
Ahua=[Ahua11 Ahua12 Ahua13;Ahua21 Ahua22 Ahua23;Ahua31 Ahua32 Ahua33];
Ahuahe=Ahua11+Ahua12+Ahua13+Ahua21+Ahua22+Ahua23+Ahua31+Ahua32+Ahua33;
A1=-K*Ahuahe*C*A;
% A2=-K*Ahuahe*C*A;
A2=-K*Ahuahe;
A3=-K*Ahuahe*D;
N1=kron(A1,I3);
N2=kron(A2,I3);
N3=[A3;A3;A3];
Aba=kron(I3,A);
Bba=[0.2;0.1;0.2;0.1;0.2;0.1];
Eba=kron(I3,E);
AN=Aba+N1;
EN=Eba+N1;
BN=Bba+N3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Aba=kron(I3,A);
% Bba=[0.2;0.1;0.2;0.1;0.2;0.1];
% Eba=kron(I3,E);
% Mba=kron(I3,M);
% Dba=[0.2;0.2;0.2];
% Cba=kron(I3,C);
% Kba=kron(I3,diag(K));
% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Acba=kron(I3,C*A);
% Ahua11=1;
% Ahua12=0;
% Ahua13=0;
% Ahua21=1;
% Ahua22=1;
% Ahua23=0;
% Ahua31=0;
% Ahua32=0;
% Ahua33=1;
% Ahua=[Ahua11 Ahua12 Ahua13;Ahua21 Ahua22 Ahua23;Ahua31 Ahua32 Ahua33];
%
% Ahuahe=Ahua11*I2+Ahua12*I2+Ahua13*I2+Ahua21*I2+Ahua22*I2+Ahua23*I2+Ahua31*I2+Ahua32*I2+Ahua33*I2;
% N1=-Kba*kron(I3,Ahuahe)*Acba;
% N2=-Kba*kron(I3,Ahuahe);
% N3=-Kba*kron(I3,Ahuahe)*Dba;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% N1=-Kba*kron(Ahua,I6)*Acba;
% N2=-Kba*kron(Ahua,I6);
% N3=-Kba*kron(Ahua,I6)*Dba;
% AN=Aba+N1;
% EN=Eba+N1;
% BN=Bba+N3;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
setlmis([]);
P11=lmivar(1,[6,1]);
P12=lmivar(2,[6,6]);
P13=lmivar(2,[6,6]);
P22=lmivar(1,[6,1]);
P23=lmivar(2,[6,6]);
P33=lmivar(1,[6,1]);
U1=lmivar(1,[6,1]);
U2=lmivar(1,[6,1]);
Q1=lmivar(1,[6,1]);
Q2=lmivar(1,[6,1]);
Q3=lmivar(1,[6,1]);
R1=lmivar(1,[6,1]);
R2=lmivar(1,[6,1]);
W1=lmivar(1,[6,1]);
W2=lmivar(1,[6,1]);
W3=lmivar(1,[6,1]);
Z1=lmivar(1,[2,1]);
Z2=lmivar(1,[2,1]);
V1=lmivar(1,[2,1]);
V2=lmivar(1,[2,1]);
Z1a=kron(I3,Z1);
Z2a=kron(I3,Z2);
V1a=kron(I3,V1);
V2a=kron(I3,V2);
Z1awan=0.5*sym(Z1a'*Z2a);
Z2awan=-0.5*sym(Z1a'+Z2a');
V1awan=0.5*sym(V1a'*V2a);
V2awan=-0.5*sym(V1a'+V2a');
Z1awan=lmivar(1,[6,1]);
Z2awan=lmivar(1,[6,1]);
V1awan=lmivar(1,[6,1]);
V2awan=lmivar(1,[6,1]);
%LMI 大矩阵
%11
lmiterm([1 1 1 P11],1,AN,'s');
lmiterm([1 1 1 P12],1,1,'s');
lmiterm([1 1 1 P13],1,1,'s');
lmiterm([1 1 1 Q1],1,1);
lmiterm([1 1 1 Q2],1,1);
lmiterm([1 1 1 Q3],1,1);
lmiterm([1 1 1 R1],h1*h1*AN',AN);
lmiterm([1 1 1 R2],h12*h12*AN',AN);
lmiterm([1 1 1 W1],0.25*h1*h1*AN',AN);
lmiterm([1 1 1 W2],0.25*h2*h2*AN',AN);
lmiterm([1 1 1 W3],0.25*hs*hs*AN',AN);
lmiterm([1 1 1 Z1awan],-lamuta1,1);
lmiterm([1 1 1 V2awan],-lamuta2,1);
%12
lmiterm([1 1 2 R1],h1*h1*AN',EN);
lmiterm([1 1 2 R2],h12*h12*AN',EN);
lmiterm([1 1 2 W1],0.25*h1*h1*AN',EN);
lmiterm([1 1 2 W2],0.25*h2*h2*AN',EN);
lmiterm([1 1 2 W3],0.25*hs*hs*AN',EN);
%13
lmiterm([1 1 3 P11],1,1);
lmiterm([1 1 3 R1],h1*h1*AN',1);
lmiterm([1 1 3 R2],h12*h12*AN',1);
lmiterm([1 1 3 W1],0.25*h1*h1*AN',1);
lmiterm([1 1 3 W2],0.25*h2*h2*AN',1);
lmiterm([1 1 3 W3],0.25*hs*hs*AN',1);
lmiterm([1 1 3 Z2awan],-lamuta2,1);
%14
lmiterm([1 1 4 P11],1,N2);
lmiterm([1 1 4 R1],h1*h1*AN',N2);
lmiterm([1 1 4 R2],h12*h12*AN',N2);
lmiterm([1 1 4 W1],0.25*h1*h1*AN',N2);
lmiterm([1 1 4 W2],0.25*h2*h2*AN',N2);
lmiterm([1 1 4 W3],0.25*hs*hs*AN',N2);
% lmiterm([1 1 4 V2awan],-lamuta2,1);
%22
lmiterm([1 2 2 Q3],mu-1,1);
lmiterm([1 2 2 R1],h1*h1*EN',EN);
lmiterm([1 2 2 R2],h12*h12*EN',EN);
lmiterm([1 2 2 W1],0.25*h1*h1*EN',EN);
lmiterm([1 2 2 W2],0.25*h2*h2*EN',EN);
lmiterm([1 2 2 W3],0.25*hs*hs*EN',EN);
%23
lmiterm([1 2 3 R1],h1*h1*EN',1);
lmiterm([1 2 3 R2],h12*h12*EN',1);
lmiterm([1 2 3 W1],0.25*h1*h1*EN',1);
lmiterm([1 2 3 W2],0.25*h2*h2*EN',1);
lmiterm([1 2 3 W3],0.25*hs*hs*EN',1);
%24
lmiterm([1 2 4 R1],h1*h1*EN',N2);
lmiterm([1 2 4 R2],h12*h12*EN',N2);
lmiterm([1 2 4 W1],0.25*h1*h1*EN',N2);
lmiterm([1 2 4 W2],0.25*h2*h2*EN',N2);
lmiterm([1 2 4 W3],0.25*hs*hs*EN',N2);
%33
lmiterm([1 3 3 U1],1,1);
lmiterm([1 3 3 R1],h1*h1,1);
lmiterm([1 3 3 R2],h12*h12,1);
lmiterm([1 3 3 W1],0.25*h1*h1,1);
lmiterm([1 3 3 W2],0.25*h2*h2,1);
lmiterm([1 3 3 W3],0.25*hs*hs,1);
lmiterm([1 3 3 1],-lamuta1,I6);
%34
lmiterm([1 3 4 R1],h1*h1,N2);
lmiterm([1 3 4 R2],h12*h12,N2);
lmiterm([1 3 4 W1],0.25*h1*h1,N2);
lmiterm([1 3 4 W2],0.25*h2*h2,N2);
lmiterm([1 3 4 W3],0.25*hs*hs,N2);
%44
% lmiterm([1 4 4 U2],1,1);
lmiterm([1 4 4 R1],h1*h1*N2',N2);
lmiterm([1 4 4 R2],h12*h12*N2',N2);
lmiterm([1 4 4 W1],0.25*h1*h1*N2',N2);
lmiterm([1 4 4 W2],0.25*h2*h2*N2',N2);
lmiterm([1 4 4 W3],0.25*hs*hs*N2',N2);
%15-----xi11
lmiterm([1 1 5 P11],1,EN);
lmiterm([1 1 5 P11],-1,1);
lmiterm([1 1 5 P13],-1,1);
%17-----xi13
lmiterm([1 1 7 -P22],1,1);
lmiterm([1 1 7 -P23],1,1);
lmiterm([1 1 7 -W1],h1,1);
%18-----xi14
lmiterm([1 1 8 -P33],1,1);
lmiterm([1 1 8 -W2],h2,1);
%19-----xi15
lmiterm([1 1 9 -W3],h12,1);
%55-----ou11
lmiterm([1 5 5 Q1],-1,1);
%57-----ou13
lmiterm([1 5 7 -P12],-1,1);
lmiterm([1 5 7 -P23],-1,1);
%58-----ou14
lmiterm([1 5 8 -P33],-1,1);
%66-----ou22
lmiterm([1 6 6 Q2],-1,1);
%77-----ou33
lmiterm([1 7 7 W1],-1,1);
%88-----ou44
lmiterm([1 8 8 W2],-1,1);
%99-----ou55
lmiterm([1 9 9 W3],-1,1);
%LMI2-12 PQRW
lmiterm([-2 1 1 P11],1,1);
lmiterm([-2 1 2 P12],1,1);
lmiterm([-2 1 3 P13],1,1);
lmiterm([-2 2 2 P22],1,1);
lmiterm([-2 2 3 P23],1,1);
lmiterm([-2 3 3 P33],1,1);
lmiterm([-3 1 1 Q1],1,1);
lmiterm([-4 1 1 Q2],1,1);
lmiterm([-5 1 1 Q3],1,1);
lmiterm([-6 1 1 U1],1,1);
lmiterm([-7 1 1 U2],1,1);
lmiterm([-8 1 1 R1],1,1);
lmiterm([-9 1 1 R2],1,1);
lmiterm([-10 1 1 W1],1,1);
lmiterm([-11 1 1 W2],1,1);
lmiterm([-12 1 1 W3],1,1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
lmis=getlmis;
[tmin,xfeas]=feasp(lmis,[0,0,0,0,0],0);
% H=dec2mat(lmis,xfeas,H);
tmin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% celiang=C*A*x(t);