%% Specify Matrix Variable Structures
%
% Suppose that the variables of the problem include a 3-by-3 symmetric matrix X and a 3-by-3 symmetric Toeplitz matrix, Y, given by:
% $$Y = \left( {\matrix{
%    {{y_1}} & {{y_2}} & {{y_3}}  \cr
%    {{y_2}} & {{y_1}} & {{y_2}}  \cr
%    {{y_3}} & {{y_2}} & {{y_1}}  \cr
%
%  } } \right).$$
% The variable Y has three independent entries, and thus involves three decision variables.  Since Y is independent of X, label these decision variables n + 1, n + 2, and n + 3, where n is the number of decision variables involved in X. To retrieve this number, define the Type 1 variable X.

setlmis([]) 
[X,n] = lmivar(1,[3 1]);
n

% The second output argument n gives the total number of decision variables used so far, which in this case is n = 6. Given this number, you can define Y.

Y = lmivar(3,n+[1 2 3;2 1 2;3 2 1]);

% An equivalent expression to define Y uses the MATLAB(R) command toeplitz to generate the matrix.

Y = lmivar(3,toeplitz(n+[1 2 3]));

% To confirm the variables, visualize the decision variable distributions in X and Y using decinfo.

lmis = getlmis; 
decinfo(lmis,X)
decinfo(lmis,Y)

% Copyright 2012 The MathWorks, Inc.