# simplify

Simplify representation of uncertain object

## Syntax

```B = simplify(A)
B = simplify(A,'full')
B = simplify(A,'basic')
B = simplify(A,'class')
```

## Description

`B = simplify(A) ` performs model-reduction-like techniques to detect and eliminate redundant copies of uncertain elements. Depending on the result, the class of `B` may be lower than `A`. The `AutoSimplify` property of each uncertain element in `A` governs what reduction methods are used. After reduction, any uncertain element which does not actually affect the result is deleted from the representation.

`B = simplify(A,'full') ` overrides all uncertain element's `AutoSimplify` property, and uses `'full'` reduction techniques.

`B = simplify(A,'basic') ` overrides all uncertain element's `AutoSimplify` property, and uses` 'basic'` reduction techniques.

`B = simplify(A,'class') ` does not perform reduction. However, any uncertain elements in `A` with zero occurrences are eliminated, and the class of `B` may be lower than the class of `A`.

## Examples

Create a simple `umat` with a single uncertain real parameter. Select specific elements, note that result remains in class `umat`. Simplify those same elements, and note that class changes.

```p1 = ureal('p1',3,'Range',[2 5]); L = [2 p1]; L(1) UMAT: 1 Rows, 1 Columns L(2) UMAT: 1 Rows, 1 Columns p1: real, nominal = 3, range = [2 5], 1 occurrence simplify(L(1)) ans = 2 simplify(L(2)) Uncertain Real Parameter: Name p1, NominalValue 3, Range [2 5] ```

Create four uncertain real parameters, with a default value of `AutoSimplify('basic')`, and define a high order polynomial .

```m = ureal('m',125000,'Range',[100000 150000]); xcg = ureal('xcg',.23,'Range',[.15 .31]); zcg = ureal('zcg',.105,'Range',[0 .21]); va = ureal('va',80,'Range',[70 90]); cw = simplify(m/(va*va)*va,'full') UMAT: 1 Rows, 1 Columns m: real, nominal = 1.25e+005, range = [100000 150000], 1 occurrence va: real, nominal = 80, range = [70 90], 1 occurrence cw = m/va; fac2 = .16726*xcg*cw*cw*zcg - .17230*xcg*xcg*cw ... -3.9*xcg*cw*zcg - .28*xcg*xcg*cw*cw*zcg ... -.07*xcg*xcg*zcg + .29*xcg*xcg*cw*zcg ... + 4.9*xcg*cw - 2.7*xcg*cw*cw ... +.58*cw*cw - 0.25*xcg*xcg - 1.34*cw ... +100.1*xcg -14.1*zcg - 1.91*cw*cw*zcg ... +1.12*xcg*zcg + 24.6*cw*zcg ... +.45*xcg*xcg*cw*cw - 46.85 UMAT: 1 Rows, 1 Columns m: real, nominal = 1.25e+005, range = [100000 150000], 18 occurrences va: real, nominal = 80, range = [70 90], 8 occurrences xcg: real, nominal = 0.23, range = [0.15 0.31], 18 occurrences zcg: real, nominal = 0.105, range = [0 0.21], 1 occurrence ```

The result of the high-order polynomial is an inefficient representation involving 18 copies of `m`, 8 copies of `va`, 18 copies of `xcg` and 1 copy of `zcg`. Simplify the expression, using the `'full'` simplification algorithm

```fac2s = simplify(fac2,'full') UMAT: 1 Rows, 1 Columns m: real, nominal = 1.25e+005, range = [100000 150000], 4 occurrences va: real, nominal = 80, range = [70 90], 4 occurrences xcg: real, nominal = 0.23, range = [0.15 0.31], 2 occurrences zcg: real, nominal = 0.105, range = [0 0.21], 1 occurrence ```

which results in a much more economical representation.

Alternatively, change the `AutoSimplify` property of each parameter to `'full'` before forming the polynomial.

```m.AutoSimplify = 'full'; xcg.AutoSimplify = 'full'; zcg.AutoSimplify = 'full'; va.AutoSimplify = 'full'; ```

You can form the polynomial, which immediately gives a low order representation.

```cw = m/va; fac2f = .16726*xcg*cw*cw*zcg - .17230*xcg*xcg*cw ... -3.9*xcg*cw*zcg - .28*xcg*xcg*cw*cw*zcg ... -.07*xcg*xcg*zcg + .29*xcg*xcg*cw*zcg ... + 4.9*xcg*cw - 2.7*xcg*cw*cw ... +.58*cw*cw - 0.25*xcg*xcg - 1.34*cw ... +100.1*xcg -14.1*zcg - 1.91*cw*cw*zcg ... +1.12*xcg*zcg + 24.6*cw*zcg ... +.45*xcg*xcg*cw*cw - 46.85 UMAT: 1 Rows, 1 Columns m: real, nominal = 1.25e+005, range = [100000 150000], 4 occurrences va: real, nominal = 80, range = [70 90], 4 occurrences xcg: real, nominal = 0.23, range = [0.15 0.31], 2 occurrences zcg: real, nominal = 0.105, range = [0 0.21], 1 occurrence ```

Create two real parameters, `da` and `dx`, and a 2-by-3 matrix, `ABmat`, involving polynomial expressions in the two real parameters .

```da = ureal('da',0,'Range',[-1 1]); dx = ureal('dx',0,'Range',[-1 1]); a11 = -.32 + da*(.8089 + da*(-.987 + 3.39*da)) + .15*dx; a12 = .934 + da*(.0474 - .302*da); a21 = -1.15 + da*(4.39 + da*(21.97 - 561*da*da)) ... + dx*(9.65 - da*(55.7 + da*177)); a22 = -.66 + da*(1.2 - da*2.27) + dx*(2.66 - 5.1*da); b1 = -0.00071 + da*(0.00175 - da*.00308) + .0011*dx; b2 = -0.031 + da*(.078 + da*(-.464 + 1.37*da)) + .0072*dx; ABmat = [a11 a12 b1;a21 a22 b2] UMAT: 2 Rows, 3 Columns da: real, nominal = 0, range = [-1 1], 19 occurrences dx: real, nominal = 0, range = [-1 1], 2 occurrences ```

Use `'full'` simplification to reduce the complexity of the description.

```ABmatsimp = simplify(ABmat,'full') UMAT: 2 Rows, 3 Columns da: real, nominal = 0, range = [-1 1], 7 occurrences dx: real, nominal = 0, range = [-1 1], 2 occurrences ```

Alternatively, you can set the parameter's `AutoSimplify` property to `'full'`.

```da.AutoSimplify = 'full'; dx.AutoSimplify = 'full'; ```

Now you can rebuild the matrix

```a11 = -.32 + da*(.8089 + da*(-.987 + 3.39*da)) + .15*dx; a12 = .934 + da*(.0474 - .302*da); a21 = -1.15 + da*(4.39 + da*(21.97 - 561*da*da)) ... + dx*(9.65 - da*(55.7 + da*177)); a22 = -.66 + da*(1.2 - da*2.27) + dx*(2.66 - 5.1*da); b1 = -0.00071 + da*(0.00175 - da*.00308) + .0011*dx; b2 = -0.031 + da*(.078 + da*(-.464 + 1.37*da)) + .0072*dx; ABmatFull = [a11 a12 b1;a21 a22 b2] UMAT: 2 Rows, 3 Columns da: real, nominal = 0, range = [-1 1], 7 occurrences dx: real, nominal = 0, range = [-1 1], 2 occurrences ```

## Limitations

Multidimensional model reduction and realization theory are only partially complete theories. The heuristics used by `simplify` are that - heuristics. The order in which expressions involving uncertain elements are built up, eg., distributing across addition and multiplication, can affect the details of the representation (i.e., the number of occurrences of a `ureal` in an uncertain matrix). It is possible that `simplify`'s naive methods cannot completely resolve these differences, so one may be forced to work with “nonminimal” representations of uncertain systems.

## Algorithms

`simplify` uses heuristics along with one-dimensional model reduction algorithms to partially reduce the dimensionality of the representation of an uncertain matrix or system.

## References

 Varga, A. and G. Looye, “Symbolic and numerical software tools for LFT-based low order uncertainty modeling,” IEEE International Symposium on Computer Aided Control System Design, 1999, pp. 5-11.

 Belcastro, C.M., K.B. Lim and E.A. Morelli, “Computer aided uncertainty modeling for nonlinear parameter-dependent systems Part II: F-16 example,” IEEE International Symposium on Computer Aided Control System Design, 1999, pp. 17-23.

## Version History

Introduced before R2006a