Specify LMI System at the Command Line

This tutorial example shows how to specify LMI systems at the command line using the LMI Lab tools.

Specify LMI System

Consider a stable transfer function,

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

Suppose that G has four inputs, four outputs, and six states. Consider also a set of input/output scaling matrices D with block-diagonal structure given by:

`$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).$`

The following problem arises in the robust stability analysis of systems with time-varying uncertainty [4]. Find, if any, a scaling D with the specified structure, such that the largest gain across frequency of $DG\left(s\right){D}^{-1}$ is less than 1.

This problem has a simple LMI formulation: There exists an adequate scaling D if the following feasibility problem has solutions. Find two symmetric matrices $X\in {R}_{6×6}$ and $S={D}^{T}D\in {R}_{4×4}$ such that:

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

`$X>0,$`

`$S>1.$`

You can use the LMI Editor to specify the LMI problem described by these expressions, as shown in Specify LMIs with the LMI Editor GUI. Alternatively, define it at the command line using `lmivar` and `lmiterm`, as follows.

For this example, use the following values for A, B, and C.

```A = [ -0.8715 0.5202 0.7474 1.0778 -0.9686 0.1005; -0.5577 -1.0843 1.8912 0.2523 1.0641 -0.0345; -0.2615 -1.7539 -1.5452 -0.2143 0.0923 -2.4192; 0.6087 -1.0741 0.1306 -2.5575 2.3213 0.2388; -0.7169 0.3582 -1.4195 1.7043 -2.6530 -1.4276; -1.2944 -0.6752 1.6983 1.6764 -0.3646 -1.7730 ]; B = [ 0 0.8998 -0.2130 0.9835; 0 -0.3001 0 -0.2977; -1.0322 0 -1.0431 1.1437; 0 -0.3451 -0.2701 -0.5316; -0.4189 1.0128 -0.4381 0; 0 0 -0.4087 0]; C = [ 0 2.0034 0 1.0289 0.1554 0.7135; 0.9707 0.9510 0.7059 1.4580 -1.2371 0.3174; 0 0 1.4158 0.0475 -2.1935 0.4136; -0.4383 0.6489 -1.6045 1.7463 -0.3334 -0.5771];```

Define the LMI variables `X` and `S`, and then specify the terms of each LMI.

```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;```

The `lmivar` commands define the two matrix variables, X and S. The `lmiterm` commands describe the terms in each LMI. `getlmis` returns the internal representation `LMISYS` of this LMI problem.

For more details on how to use these commands, see:

For more information about how `lmivar` updates the internal representation of the LMI problem, see 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 matrix Dj= 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 Specify LMI System, the matrix variables X and S are of Type 1. Indeed, both are symmetric and S inherits the block-diagonal structure 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).$`

Initialize the description and declare these two matrix variables.

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

In both `lmivar` 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 Specify 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 the expression:

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

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.

When describing the term content of an LMI, 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 Specify 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 Specify 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, get the internal representation of the problem.

`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.