# lmivar

Specify matrix variables in LMI problem

## Description

defines a new matrix variable in the LMI system currently described. The array
`X`

= lmivar(`type`

,`structure`

)`structure`

specifies the structure of the variable. The optional
output `X`

is an identifier that can be used for subsequent reference to
the variable. Before using `lmivar`

to create any variables, initialize
the LMI system using `setlmis`

.

## Examples

### Type 1 and Type 2 Matrix Variables

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.

### 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(\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

## Input Arguments

`type`

— Matrix variable type

1 | 2 | 3

Matrix variable type, specified as 1, 2, or 3.

1 — Symmetric matrix with a block diagonal structure. Use

`structure`

to specify the size and structure of the diagonal blocks.2 — Full rectangular matrix. Use

`structure`

to specify the dimensions of the matrix.3 — Other structure. Use

`structure`

to provide further information about the structure of the variable.

`structure`

— Matrix variable structure

array

Matrix variable structure, specified as an array. How you specify the structure depends on the variable type.

`type` | `structure` |
---|---|

`type = 1` | For a matrix variable with `structure(i,1)` specifies the block size.`structure(i,2)` specifies the block type.`structure(i,2) = 0` for a scalar block (a scalar multiple of the identity matrix).`structure(i,2) = 1` for a full block (arbitrary symmetric matrix).`structure(i,2) = -1` for a zero block.
For instance, if the first block of |

`type = 2` | For a full rectangular |

`type = 3` | You can use Type 3 to specify sophisticated matrix variable
structures. To specify a variable `0` , if`X(i,j) = 0` .`k` , if`X(i,j)` is the*k*th decision variable.`-k` , if`X(i,j)` is`(-1)` times the*k*th decision variable.
To help specify matrix variables of Type 3, use the
For examples specifying Type 3 LMI variables, see Type 3 Matrix Variables and Advanced LMI Techniques. |

## Output Arguments

`X`

— Identifier for matrix variable

positive integer

Identifier for matrix variable, returned as a positive integer. The value of this
identifier is `k`

, where `k-1`

is the number of matrix
variables previously declared in this LMI problem. The value of this identifier is not
affected by subsequent modifications of the LMI system.

`n`

— Number of decision variables

positive integer

Number of decision variables in the system so far, returned as a positive integer.
This value includes the decision variables in `X`

and those in
previously defined LMI variables.

`sX`

— Dependence of `X`

on decision variables

matrix

Dependence of `X`

on decision variables, returned as a matrix.
Each entry in `sX`

is either `0`

, the index of a
decision variable, or minus the index of a decision variable. For instance, suppose that
`X`

depends on two decision variables,
*x*_{1} and
*x*_{1}, as follows:

$$X=\left(\begin{array}{cc}0& -{x}_{1}\\ {x}_{2}& 0\end{array}\right)$$

When you create the variable `X`

, the `lmivar`

command returns the following `sX`

.

`sX = `*2×2*
0 -1
2 0

## Version History

**Introduced before R2006a**

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)