# Documentation

## Specify LMI System at the Command Line

The following tutorial example is used to illustrate the specification of LMI systems with the LMI Lab tools.

### Specifying LMI System

Consider a stable transfer function

 $G\left(s\right)=C{\left(sI-A\right)}^{-1}B$ (4-4)

with four inputs, four outputs, and six states, and consider the set of input/output scaling matrices D with block-diagonal structure

 $D=\left(\begin{array}{cccc}{d}_{1}& 0& 0& 0\\ 0& {d}_{1}& 0& 0\\ 0& 0& {d}_{2}& {d}_{3}\\ 0& 0& {d}_{4}& {d}_{5}\end{array}\right).$ (4-5)

The following problem arises in the robust stability analysis of systems with time-varying uncertainty [4]:

Find, if any, a scaling D of structure (Equation 4-5) such that the largest gain across frequency of D G(s) D–1 is less than one.

This problem has a simple LMI formulation: there exists an adequate scaling D if the following feasibility problem has solutions:

Find two symmetric matrices XR6×6 and S = DT DR4×4 such that

 $\left(\begin{array}{cc}{A}^{T}X+XA+{C}^{T}SC& XB\\ {B}^{T}X& -S\end{array}\right)<0$ (4-6)
 $X>0$ (4-7)
 $S>1.$ (4-8)

The LMI system (Equation 4-6, Equation 4-7, and Equation 4-8) can be described with the LMI Editor as outlined below. Alternatively, its internal description can be generated with `lmivar` and `lmiterm` commands as follows:

```setlmis([]) X=lmivar(1,[6 1]) S=lmivar(1,[2 0;2 1]) % 1st LMI lmiterm([1 1 1 X],1,A,'s') lmiterm([1 1 1 S],C',C) lmiterm([1 1 2 X],1,B) lmiterm([1 2 2 S],-1,1) % 2nd LMI lmiterm([-2 1 1 X],1,1) % 3rd LMI lmiterm([-3 1 1 S],1,1) lmiterm([3 1 1 0],1) LMISYS = getlmis ```

Here the `lmivar` commands define the two matrix variables X and S while the `lmiterm` commands describe the various terms in each LMI. Upon completion, `getlmis` returns the internal representation `LMISYS` of this LMI system. The following subsections give more details on the syntax and usage of these various commands:

More information on how the internal representation is updated by `lmivar`/`lmiterm` can also be found in How lmivar and lmiterm Manage LMI Representation.

### Initializing the LMI System

The description of an LMI system should begin with `setlmis` and end with `getlmis`. The function `setlmis` initializes the LMI system description. When specifying a new system, type

```setlmis([]) ```

To add on to an existing LMI system with internal representation `LMIS0`, type

```setlmis(LMIS0) ```

### Specifying the LMI Variables

The matrix variables are declared one at a time with `lmivar` and are characterized by their structure. To facilitate the specification of this structure, the LMI Lab offers two predefined structure types along with the means to describe more general structures:

 Type 1 Symmetric block diagonal structure. This corresponds to matrix variables of the form$X=\left(\begin{array}{cccc}{D}_{1}& 0& \dots & 0\\ 0& {D}_{2}& \ddots & ⋮\\ ⋮& \ddots & \ddots & 0\\ 0& \dots & 0& {D}_{r}\end{array}\right)$where each diagonal block Dj is square and is either zero, a full symmetric matrix, or a scalar matrixDj= d × I,  d ∊ R This type encompasses ordinary symmetric matrices (single block) and scalar variables (one block of size one). Type 2 Rectangular structure. This corresponds to arbitrary rectangular matrices without any particular structure. Type 3 General structures. This third type is used to describe more sophisticated structures and/or correlations between the matrix variables. The principle is as follows: each entry of X is specified independently as either 0, xn, or –xn where xn denotes the n-th decision variable in the problem. For details on how to use Type 3, see Structured Matrix Variables as well as the `lmivar` entry in the reference pages.

In Specifying LMI System, the matrix variables X and S are of Type 1. Indeed, both are symmetric and S inherits the block-diagonal structure from Equation 4-5 of D. Specifically, S is of the form

$S=\left(\begin{array}{cccc}{s}_{1}& 0& 0& 0\\ 0& {s}_{1}& 0& 0\\ 0& 0& {s}_{2}& {s}_{3}\\ 0& 0& {s}_{3}& {s}_{4}\end{array}\right).$

After initializing the description with the command `setlmis([])`, these two matrix variables are declared by

```lmivar(1,[6 1]) % X lmivar(1,[2 0;2 1]) % S ```

In both commands, the first input specifies the structure type and the second input contains additional information about the structure of the variable:

• For a matrix variable X of Type 1, this second input is a matrix with two columns and as many rows as diagonal blocks in X. The first column lists the sizes of the diagonal blocks and the second column specifies their nature with the following convention:

1: full symmetric block

0: scalar block

–1: zero block

In the second command, for instance,`[2 0;2 1]` means that S has two diagonal blocks, the first one being a 2-by-2 scalar block and the second one a 2-by-2 full block.

• For matrix variables of Type 2, the second input of `lmivar` is a two-entry vector listing the row and column dimensions of the variable. For instance, a 3-by-5 rectangular matrix variable would be defined by

```lmivar(2,[3 5]) ```

For convenience, `lmivar` also returns a "tag" that identifies the matrix variable for subsequent reference. For instance, X and S in Specifying LMI System could be defined by

```X = lmivar(1,[6 1]) S = lmivar(1,[2 0;2 1]) ```

The identifiers X and S are integers corresponding to the ranking of X and S in the list of matrix variables (in the order of declaration). Here their values would be `X=1` and `S=2`. Note that these identifiers still point to X and S after deletion or instantiation of some of the matrix variables. Finally, `lmivar` can also return the total number of decision variables allocated so far as well as the entry-wise dependence of the matrix variable on these decision variables (see the `lmivar` entry in the reference pages for more details).

### Specifying Individual LMIs

After declaring the matrix variables with `lmivar`, we are left with specifying the term content of each LMI. Recall that LMI terms fall into three categories:

• The constant terms, i.e., fixed matrices like I in the left side of the LMI S > I

• The variable terms, i.e., terms involving a matrix variable. For instance, ATX and CTSC in Equation 4-6. Variable terms are of the form PXQ where X is a variable and P, Q are given matrices called the left and right coefficients, respectively.

• The outer factors

The following rule should be kept in mind when describing the term content of an LMI:

 Note:   Specify only the terms in the blocks on or above the diagonal. The inner factors being symmetric, this is sufficient to specify the entire LMI. Specifying all blocks results in the duplication of off-diagonal terms, hence in the creation of a different LMI. Alternatively, you can describe the blocks on or below the diagonal.

LMI terms are specified one at a time with `lmiterm`. For instance, the LMI

$\left(\begin{array}{cc}{A}^{T}X+XA+{C}^{T}SC& XB\\ {B}^{T}X& -S\end{array}\right)<0$

is described by

```lmiterm([1 1 1 1],1,A,'s') lmiterm([1 1 1 2],C',C) lmiterm([1 1 2 1],1,B) lmiterm([1 2 2 2],-1,1) ```

These commands successively declare the terms ATX + XA, CTSC, XB, and –S. In each command, the first argument is a four-entry vector listing the term characteristics as follows:

• The first entry indicates to which LMI the term belongs. The value `m` means "left side of the m-th LMI," and −`m` means "right side of the m-th LMI."

• The second and third entries identify the block to which the term belongs. For instance, the vector [`1 1 2 1`] indicates that the term is attached to the (1, 2) block.

• The last entry indicates which matrix variable is involved in the term. This entry is `0` for constant terms, `k` for terms involving the k-th matrix variable Xk, and −`k` for terms involving ${X}_{k}^{T}$ (here X and S are first and second variables in the order of declaration).

Finally, the second and third arguments of `lmiterm` contain the numerical data (values of the constant term, outer factor, or matrix coefficients P and Q for variable terms PXQ or PXTQ). These arguments must refer to existing MATLAB® variables and be real-valued. See Complex-Valued LMIs for the specification of LMIs with complex-valued coefficients.

Some shorthand is provided to simplify term specification. First, blocks are zero by default. Second, in diagonal blocks the extra argument `'s'` allows you to specify the conjugated expression AXB + BTXTAT with a single `lmiterm` command. For instance, the first command specifies ATX + XA as the "symmetrization" of XA. Finally, scalar values are allowed as shorthand for scalar matrices, i.e., matrices of the form αI with α scalar. Thus, a constant term of the form αI can be specified as the "scalar" α. This also applies to the coefficients P and Q of variable terms. The dimensions of scalar matrices are inferred from the context and set to 1 by default. For instance, the third LMI S > I in Example: Specifying Matrix Variable Structures is described by

```lmiterm([-3 1 1 2],1,1) % 1*S*1 = S lmiterm([3 1 1 0],1) % 1*I = I ```

Recall that by convention `S` is considered as the right side of the inequality, which justifies the –3 in the first command.

Finally, to improve readability it is often convenient to attach an identifier (tag) to each LMI and matrix variable. The variable identifiers are returned by `lmivar` and the LMI identifiers are set by the function `newlmi`. These identifiers can be used in `lmiterm` commands to refer to a given LMI or matrix variable. For the LMI system of Specifying LMI System, this would look like:

```setlmis([]) X = lmivar(1,[6 1]) S = lmivar(1,[2 0;2 1]) BRL = newlmi lmiterm([BRL 1 1 X],1,A,'s') lmiterm([BRL 1 1 S],C',C) lmiterm([BRL 1 2 X],1,B) lmiterm([BRL 2 2 S],-1,1) Xpos = newlmi lmiterm([-Xpos 1 1 X],1,1) Slmi = newlmi lmiterm([-Slmi 1 1 S],1,1) lmiterm([Slmi 1 1 0],1) ```

When the LMI system is completely specified, type

```LMISYS = getlmis ```

This returns the internal representation `LMISYS` of this LMI system. This MATLAB description of the problem can be forwarded to other LMI-Lab functions for subsequent processing. The command `getlmis` must be used only once and after declaring all matrix variables and LMI terms.

Here the identifiers `X` and `S` point to the variables X and S while the tags `BRL`, `Xpos`, and `Slmi` point to the first, second, and third LMI, respectively. Note that –`Xpos` refers to the right-hand side of the second LMI. Similarly, –`X` would indicate transposition of the variable X.

Was this topic helpful?

Get trial now