Main Content

# lmivar

Specify matrix variables in LMI problem

## Syntax

```X = lmivar(type,struct)
[X,n,sX] = lmivar(type,struct)
```

## Description

`lmivar` defines a new matrix variable X in the LMI system currently described. The optional output `X` is an identifier that can be used for subsequent reference to this new variable.

The first argument `type` selects among available types of variables and the second argument `struct` gives further information on the structure of X depending on its type. Available variable types include:

type=1: Symmetric matrices with a block-diagonal structure. Each diagonal block is either full (arbitrary symmetric matrix), scalar (a multiple of the identity matrix), or identically zero.

If X has R diagonal blocks, `struct` is an R-by-2 matrix where

• `struct(r,1)` is the size of the r-th block

• `struct(r,2)` is the type of the r-th block (1 for full, 0 for scalar, –1 for zero block).

type=2: Full m-by-n rectangular matrix. Set `struct = [m,n]` in this case.

type=3: Other structures. With Type 3, each entry of X is specified as zero or ±x where xn is the n-th decision variable.

Accordingly, `struct` is a matrix of the same dimensions as X such that

• `struct(i,j)=0` if X(i, j) is a hard zero

• `struct(i,j)=n` if X(i, j) = xn

• `struct(i,j)=–n` if X(i, j) = –xn

Sophisticated matrix variable structures can be defined with Type 3. To specify a variable X of Type 3, first identify how many free independent entries are involved in X. These constitute the set of decision variables associated with X. If the problem already involves n decision variables, label the new free variables as xn+1, . . ., xn+p. The structure of X is then defined in terms of xn+1, . . ., xn+p as indicated above. To help specify matrix variables of Type 3, `lmivar` optionally returns two extra outputs: (1) the total number n of scalar decision variables used so far and (2) a matrix `sX` showing the entry-wise dependence of X on the decision variables x1, . . ., xn.

## Examples

collapse all

Consider an LMI system with three matrix variables ${X}_{1}$, ${X}_{2}$, and ${X}_{3}$ such that

• ${X}_{1}$ is a 3-by-3 symmetric matrix (unstructured),

• ${X}_{2}$ is a 2-by-4 rectangular matrix (unstructured),

• ${X}_{3}$ =

`$\left(\begin{array}{ccc}\Delta & 0& 0\\ 0& {\delta }_{1}& 0\\ 0& 0& {\delta }_{2}{I}_{2}\end{array}\right),$`

where Δ is an arbitrary 5-by-5 symmetric matrix, ${\delta }_{1}$ and ${\delta }_{2}$ are scalars, and ${I}_{2}$ denotes the identity matrix of size 2.

Define these three variables using `lmivar`.

```setlmis([]) X1 = lmivar(1,[3 1]); % Type 1 X2 = lmivar(2,[2 4]); % Type 2 of dimension 2-by-4 X3 = lmivar(1,[5 1;1 0;2 0]); % Type 1```

The last command defines ${X}_{3}$ as a variable of Type 1 with one full block of size 5 and two scalar blocks of sizes 1 and 2, respectively.

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(\begin{array}{cc}{X}_{1}& 0\\ 0& {X}_{2}\end{array}\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`
```sX1 = 2×3 1 2 3 4 5 6 ```
`sX2`
```sX2 = 3×2 7 8 9 10 11 12 ```

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`
```sX = 5×5 1 2 3 0 0 4 5 6 0 0 0 0 0 7 8 0 0 0 9 10 0 0 0 11 12 ```

## Version History

Introduced before R2006a