lmi的分辨率为两个变量提供0值(它应该在0和1之间(
LMI用于容错控制系统
程序如下:
while true
setlmis([])
P_1 = lmivar(1,[2*n,1]);
P_2 = lmivar(1,[2*n,1]);
[G_1, l, sG_1] = lmivar(1,[n,1]);
[G_2, l, sG_2] = lmivar(1,[n,1]);
[L_1, l, sL_1] = lmivar(2,[n,m]);
[L_2, l, sL_2] = lmivar(2,[n,m]);
[k_1, l, sk_1] = lmivar(2,[m,n]);
[k_2, l, sk_2] = lmivar(2,[m,n]);
[K_1, l, slk] = lmivar(3,[sG_1,sL_1,zeros(n),[0;0];
sk_1, 0, [0 0], 0;
zeros(n), [0;0], sG_1, sL_1;
[0 0], 0 sk_1, 0]);
K_2 = lmivar(3,[sG_2,sL_2,zeros(n),[0;0];
sk_2, 0, [0 0], 0;
zeros(n), [0;0], sG_2, sL_2;
[0 0], 0 sk_2, 0]);
V_1 = lmivar(1,[1,0]);
V_2 = lmivar(1,[1,0]);
Q = [zeros(n) [0;0] zeros(n) [0;0]; -eye(n) [0;0] zeros(n) [0;0]];
counter = 1;
i = 1;
j = 1;
while counter <= 4
if i ==1 && j ==1
P_i = P_1;
P_j = P_1;
Vi = V_1;
Ki = K_1;
Ai = [A1 zeros(n) ; A1 zeros(n)];
Bi = [zeros(n) [0;0] zeros(n) B1; zeros(n) [0;0] -eye(n) B1];
C_Ci = [zeros(n) eye(n); [0 0] [0 0]; eye(n) -eye(n); C1 [0 0]];
Ci = [[0 0] C1];
Di = [N1 M1];
Ei =[E1 F1; E1 F1];
Ri = [[0 ; 0] [0 ; 0] ; N1 M1; [0 ; 0] [0 ; 0]; 0 0];
elseif i ==1 && j ==2
P_i = P_1;
P_j = P_2;
Vi = V_1;
Ki = K_1;
Ai = [A1 zeros(n) ; A1 zeros(n)];
Bi = [zeros(n) [0;0] zeros(n) B1; zeros(n) [0;0] -eye(n) B1];
C_Ci = [zeros(n) eye(n); [0 0] [0 0]; eye(n) -eye(n); C1 [0 0]];
Ci = [[0 0] C1];
Di = [N1 M1];
Ei =[E1 F1; E1 F1];
Ri = [[0 ; 0] [0 ; 0] ; N1 M1; [0 ; 0] [0 ; 0]; 0 0];
elseif i ==2 && j ==1
P_i = P_2;
P_j = P_1;
Vi = V_2;
Ki = K_2;
Ai = [A2 zeros(n) ; A2 zeros(n)];
Bi = [zeros(n) [0;0] zeros(n) B2; zeros(n) [0;0] -eye(n) B2];
C_Ci = [zeros(n) eye(n); [0 0] [0 0]; eye(n) -eye(n); C2 [0 0]];
Ci = [[0 0] C2];
Di = [N2 M2];
Ei =[E2 F2; E2 F2];
Ri = [[0 ; 0] [0 ; 0] ; N2 M2; [0 ; 0] [0 ; 0]; 0 0];
elseif i ==2 && j ==2
P_i = P_2;
P_j = P_2;
Vi = V_2;
Ki = K_2;
Ai = [A2 zeros(n) ; A2 zeros(n)];
Bi = [zeros(n) [0;0] zeros(n) B2; zeros(n) [0;0] -eye(n) B2];
C_Ci = [zeros(n) eye(n); [0 0] [0 0]; eye(n) -eye(n); C2 [0 0]];
Ci = [[0 0] C2];
Di = [N2 M2];
Ei =[E2 F2; E2 F2];
Ri = [[0 ; 0] [0 ; 0] ; N2 M2; [0 ; 0] [0 ; 0]; 0 0];
end
lmiterm([counter,1,1,P_j],Ai',Ai)
lmiterm([counter,1,1,P_i],-1,1)
lmiterm([counter,1,1,P_j],-epsilon*Ai'*Bi*Bi',Ai)
lmiterm([counter,1,1,P_j],-epsilon*Ai',Bi*Bi'*Ai)
lmiterm([counter,1,1,0],epsilon*epsilon*Ai'*Bi*Bi'*Ai)
lmiterm([counter,3,1,Vi],1,Ci)
lmiterm([counter,4,1,0],Ai)
lmiterm([counter,4,1,Ki],Bi,C_Ci)
lmiterm([counter,5,1,P_j],Bi',Ai)
lmiterm([counter,5,1,Ki],1,C_Ci)
lmiterm([counter,6,1,Ki],epsilon*Bi,C_Ci)
lmiterm([counter,2,2,0],-current_gama*current_gama*eye(n))
lmiterm([counter,3,2,Vi],1,Di)
lmiterm([counter,4,2,0],Ei)
lmiterm([counter,4,2,Ki],Q,Ri)
lmiterm([counter,3,3,0],-1)
lmiterm([counter,4,4,0],-2*eye(2*n))
lmiterm([counter,4,4,P_j],1,1)
lmiterm([counter,5,5,0],-eye(2*n+2*m))
lmiterm([counter,6,6,P_j],1,1)
lmiterm([counter,6,6,0],-2*epsilon*eye(2*n))
counter = counter + 1;
if i == 1 && j ==1
i = 2;
j = 1;
elseif i == 2 && j == 1
i = 1;
j = 2;
elseif i == 1 && j == 2
i = 2;
j = 2;
end
end
lmiterm([-5,1,1,P_1],1,1)
lmiterm([-6,1,1,P_2],1,1)
mLMI = getlmis;
[t, x] = feasp(mLMI);
if current_gama <= 0
break;
end
if t < 0
V1 = dec2mat(mLMI, x, V_1)
V2 = dec2mat(mLMI, x, V_2)
P1 = dec2mat(mLMI, x, P_1)
P2 = dec2mat(mLMI, x, P_2)
K1 = dec2mat(mLMI, x, K_1)
K2 = dec2mat(mLMI, x, K_2)
G1 = K1(1:n, 1:n)
G2 = K2(1:n, 1:n)
L1 = K1(1:n, n+1)
L2 = K2(1:n, 1+n)
k1 = K1(n+1, 1:n)
k2 = K2(n+1, 1:n)
last_gama = current_gama;
current_gama = current_gama - gama_step;
continue;
else
current_gama = current_gama - gama_step;
continue;
end
end
其他变量都不是0,但V1和V2是等于零的标量。矩阵A1、A2、B1、B2、C1、C2、D1、D2E1、E2、F1、F2、M1、M2、N1、N2在脚本中声明为全局值如下:
A1 = [.2 -.1; 0 .4];
B1 = [.1 ; .3];
C1 = [.1 0];
E1 = [.2 ; .1];
F1 = [.13 ; .16];
N1 = 1.1;
M1 = 1.4;
A2 = [.4 .1; .1 .3];
B2 = [.3 ; .2];
C2 = [0 .1];
E2 = [.2 ; .3];
F2 = [.15 ; .12];
N2 = 1.2;
M2 = 1.5;
我们知道V1和V2是正定的,所以我的一位同事建议的技巧是添加一个LMI来指定如下:
lmiterm([-7,1,1,V1],1,1)
lmiterm([-8,1,1,V2],1,1)
这样一来,V1和V2将不会为空!