## Simplifying Representation of Uncertain Objects

A minimal realization of the transfer function matrix

`$H\left(s\right)=\left[\begin{array}{cc}\frac{2}{s+1}& \frac{4}{s+1}\\ \frac{3}{s+1}& \frac{6}{s+1}\end{array}\right]$`

has only 1 state, obvious from the decomposition

`$H\left(s\right)=\left[\begin{array}{c}2\\ 3\end{array}\right]\frac{1}{s+1}\left[\begin{array}{cc}1& 2\end{array}\right].$`

However, a “natural” construction, formed by

```sys11 = ss(tf(2,[1 1])); sys12 = ss(tf(4,[1 1])); sys21 = ss(tf(3,[1 1])); sys22 = ss(tf(6,[1 1])); sys = [sys11 sys12;sys21 sys22] a = x1 x2 x3 x4 x1 -1 0 0 0 x2 0 -1 0 0 x3 0 0 -1 0 x4 0 0 0 -1 b = u1 u2 x1 2 0 x2 0 2 x3 2 0 x4 0 2 c = x1 x2 x3 x4 y1 1 2 0 0 y2 0 0 1.5 3 d = u1 u2 y1 0 0 y2 0 0 Continuous-time model ```

has four states, and is nonminimal.

In the same manner, the internal representation of uncertain objects built up from uncertain elements can become nonminimal, depending on the sequence of operations in their construction. The command `simplify` employs ad-hoc simplification and reduction schemes to reduce the complexity of the representation of uncertain objects. There are three levels of simplification: off, basic and full. Each uncertain element has an `AutoSimplify` property whose value is either `'off'`, `'basic'` or `'full'`. The default value is `'basic'`.

After (nearly) every operation, the command `simplify` is automatically run on the uncertain object, cycling through all of the uncertain elements, and attempting to simplify (without error) the representation of the effect of that uncertain object. The `AutoSimplify` property of each element dictates the types of computations that are performed. In the `'off'` case, no simplification is even attempted. In `'basic'`, fairly simple schemes to detect and eliminate nonminimal representations are used. Finally, in `'full'`, numerical based methods similar to truncated balanced realizations are used, with a very tight tolerance to minimize error.

### Effect of the `Autosimplify` Property

Create an uncertain real parameter, view the `AutoSimplify` property of `a`, and then create a 1-by-2 `umat`, both of whose entries involve the uncertain parameter.

```a = ureal('a',4); a.AutoSimplify ans = basic m1 = [a+4 6*a] UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 1 occurrence ```

Note that although the uncertain real parameter a appears in both (two) entries of the matrix, the resulting uncertain matrix `m1` only depends on “1 occurrence” of `a`.

Set the `AutoSimplify` property of `a` to `'off'` (from `'basic'`). Recreate the 1-by-2 `umat`. Now note that the resulting uncertain matrix `m2` depends on “2 occurrences” of `a`.

```a.AutoSimplify = 'off'; m2 = [a+4 6*a] UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 2 occurrences ```

The `'basic'` level of autosimplification often detects (and simplifies) duplication created by linear terms in the various entries. Higher order (quadratic, bilinear, etc.) duplication is often not detected by the `'basic'` autosimplify level.

For example, reset the `AutoSimplify` property of a to `'basic'` (from `'off'`). Create an uncertain real parameter, and a 1-by-2 `umat`, both of whose entries involve the square of the uncertain parameter.

```a.AutoSimplify = 'basic'; m3 = [a*(a+4) 6*a*a] UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 4 occurrences ```

Note that the resulting uncertain matrix `m3` depends on “4 occurrences” of `a`.

Set the `AutoSimplify` property of `a` to `'full'` (from `'basic'`). Recreate the 1-by-2 `umat`. Now note that the resulting uncertain matrix m4 depends on “2 occurrences” of `a`.

```a.AutoSimplify = 'full'; m4 = [a*(a+4) 6*a*a] UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 2 occurrences ```

Although `m4` has a less complex representation (2 occurrences of `a` rather than 4 as in `m3`), some numerical variations are seen when both uncertain objects are evaluated at (say) 0.

```usubs(m3,'a',0) ans = 0 0 usubs(m4,'a',0) ans = 1.0e-015 * -0.4441 0 ```

Small numerical differences are also noted at other evaluation points. The example below shows the differences encountered evaluating at `a` equal to 1.

```usubs(m3,'a',1) ans = 5 6 usubs(m4,'a',1) ans = 5.0000 6.0000 ```

### Direct Use of simplify

The `simplify` command can be used to override all uncertain element's `AutoSimplify` property. The first input to the `simplify` command is an uncertain object. The second input is the desired reduction technique, which can either `'basic'` or `'full'`.

Again create an uncertain real parameter, and a 1-by-2 `umat`, both of whose entries involve the square of the uncertain parameter. Set the `AutoSimplify` property of `a` to `'basic'`.

```a.AutoSimplify = 'basic'; m3 = [a*(a+4) 6*a*a] UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 4 occurrences ```

Note that the resulting uncertain matrix `m3` depends on four occurrences of `a`.

The `simplify` command can be used to perform a `'full'` reduction on the resulting `umat`.

```m4 = simplify(m3,'full') UMAT: 1 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 2 occurrences ```

The resulting uncertain matrix `m4` depends on only two occurrences of `a` after the reduction. 