%% Type 3 Matrix Variables
% Combined with the extra outputs n and sX of lmivar, Type 3 allows you to specify fairly complex matrix variable structures. For instance, consider a matrix variable X with structure given by:
%  X = \left( {\matrix{
%   {{X_1}} & 0  \cr
%   0 & {{X_2}}  \cr
% } } \right)
% where X_1 and X_2 are 2-by-3 and 3-by-2 rectangular matrices, respectively. Specify this structure as follows.
% Define the rectangular variables X_1 and X_2.

setlmis([]) 
[X1,n,sX1] = lmivar(2,[2 3]); 
[X2,n,sX2] = lmivar(2,[3 2]);

%
% The outputs sX1 and sX2 give the decision variable content of X_1 and X_2.

sX1

%

sX2

%
% For instance, sX2(1,1) = 7 means that the (1,1) entry of X_2 is the seventh decision variable.
% Next, use Type 3 to specify the matrix variable X, and define its structure in terms of the structures of X_1 and X_2.

[X,n,sX] = lmivar(3,[sX1,zeros(2);zeros(3),sX2]);

%
% Confirm that the resulting X has the desired structure.

sX

% Copyright 2012 The MathWorks, Inc.