Main Content


Instantiate matrix variable and evaluate all LMI terms involving this matrix variable


mnewsys = setmvar(lmisys,X,Xval)


setmvar sets the matrix variable X with identifier X to the value Xval. All terms involving X are evaluated, the constant terms are updated accordingly, and X is removed from the list of matrix variables. A description of the resulting LMI system is returned in newsys.

The integer X is the identifier returned by lmivar when X is declared. Instantiating X with setmvar does not alter the identifiers of the remaining matrix variables.

The function setmvar is useful to freeze certain matrix variables and optimize with respect to the remaining ones. It saves time by avoiding partial or complete redefinition of the set of LMI constraints.


Consider the system

= Ax + Bu

and the problem of finding a stabilizing state-feedback law u = Kx where K is an unknown matrix.

By the Lyapunov Theorem, this is equivalent to finding P > 0 and K such that

(A + BK)P + P(A + BKT) + I < 0.

With the change of variable Y := KP, this condition reduces to the LMI

AP + PAT + BY + YTBT + I < 0.

This LMI is entered by the commands

n = size(A,1)                 % number of states 
ncon = size(B,2)              % number of inputs

P = lmivar(1,[n 1])           % P full symmetric 
Y = lmivar(2,[ncon n])        % Y rectangular

lmiterm([1 1 1 P],A,1,'s')    % AP+PA' 
lmiterm([1 1 1 Y],B,1,'s')    % BY+Y'B' 
lmiterm([1 1 1 0],1)          % I 
lmis = getlmis

To find out whether this problem has a solution K for the particular Lyapunov matrix P = I, set P to I by typing

news = setmvar(lmis,P,1)

The resulting LMI system news has only one variable Y = K. Its feasibility is assessed by calling feasp:

[tmin,xfeas] = feasp(news) 
Y = dec2mat(news,xfeas,Y)

The computed Y is feasible whenever tmin < 0.

Version History

Introduced before R2006a

See Also