plant; 	% システム行列などを定義した M ファイル
% -------------------------------------------
setlmis([]);
gamma = lmivar(1, [1 1]);
X     = lmivar(1, [n 1]);
Z     = lmivar(2, [n m]);
% -------------------------------------------
lmi1 = newlmi;
lmiterm([-lmi1 1 1  X     ],  r,   1);
lmiterm([-lmi1 1 2  X     ],  A,   1);
lmiterm([-lmi1 1 2 -Z     ],  B2,  1);
lmiterm([-lmi1 1 2  X     ], -c,   1);
lmiterm([-lmi1 2 2  X     ],  r,   1);
% -------------------------------------------
lmi2 = newlmi;
lmiterm([ lmi2 1 1  X     ],  A,   1, 's');
lmiterm([ lmi2 1 1 -Z     ],  B2,  1, 's');
lmiterm([ lmi2 1 2  0     ],  B1);
lmiterm([ lmi2 3 1  X     ],  C1,  1);
lmiterm([ lmi2 3 1 -Z     ],  D12, 1);
lmiterm([ lmi2 3 2  0     ],  D11);
lmiterm([ lmi2 2 2  gamma ], -1,   1); 
lmiterm([ lmi2 3 3  gamma ], -1,   1);
% -------------------------------------------
lmisys = getlmis;
% -------------------------------------------
cobj = zeros(1,decnbr(lmisys));
cobj(1) = 1;
% -------------------------------------------
[cost, xopt] = mincx(lmisys,cobj);
% -------------------------------------------
gamma_opt  = dec2mat(lmisys,xopt,gamma)
X_opt = dec2mat(lmisys,xopt,X)
Z_opt = dec2mat(lmisys,xopt,Z)
% -------------------------------------------
K_opt = Z_opt'*inv(X_opt)
