# Documentation

## Evaluate Uncertain Elements by Substitution

Uncertain elements can be substituted for using `usubs`. For more information, see Substitution by usubs. Here, we illustrate a few special cases.

Substitute all instances of the uncertain real parameter named `a` with the number 4. This results in a `umat`, with dependence on the uncertain real parameters `b` and `c`.

```M2 = usubs(M,'a',4) ```
```M2 = Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: b: Uncertain real, nominal = 10, variability = [-20,20]%, 2 occurrences c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M2.NominalValue" to see the nominal value, "get(M2)" to see all properties, and "M2.Uncertainty" to interact with the uncertain elements. ```

Similarly, we can substitute all instances of the uncertain real parameter named `b` with `M.Uncertainty.a`, resulting in a `umat` with dependence on the uncertain real parameters `a` and `c`.

```M3 = usubs(M,'b', M.Uncertainty.a) ```
```M3 = Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: a: Uncertain real, nominal = 3, variability = [-0.5,2], 4 occurrences c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M3.NominalValue" to see the nominal value, "get(M3)" to see all properties, and "M3.Uncertainty" to interact with the uncertain elements. ```

Nominal and/or random instances can easily be specified.

```M4 = usubs(M,'a','nominal','b','random') ```
```M4 = Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M4.NominalValue" to see the nominal value, "get(M4)" to see all properties, and "M4.Uncertainty" to interact with the uncertain elements. ```

The command `usample` also generates multiple random instances of a `umat` (and `uss` and `ufrd`). See Generate Samples of Uncertain Systems for details.

### Lifting a double matrix to a umat

A not-uncertain matrix may be interpreted as an uncertain matrix that has no dependence on uncertain elements. Use the `umat` command to lift a `double` to the `umat` class.

```Md = [1 2 3;4 5 6]; M = umat(Md) ```
```M = Uncertain matrix with 2 rows, 3 columns, and no uncertain blocks. Type "M.NominalValue" to see the nominal value, "get(M)" to see all properties, and "M.Uncertainty" to interact with the uncertain elements. ```

High dimensional `double` matrices can also be lifted. Note from the display that once the matrix is interpreted as a `umat`, the third dimension and beyond are interpreted as array dimensions. See Array Management for Uncertain Objects for more information about how multidimensional arrays of uncertain objects are handled.

```Md = randn(4,5,6); M = umat(Md) ```
```M = umat(Md) M = 6x1 array of uncertain matrices with 4 rows, 5 columns, and no uncertain blocks. Type "M.NominalValue" to see the nominal value, "get(M)" to see all properties, and "M.Uncertainty" to interact with the uncertain elements. ```
```Md = randn(4,5,6,7); M = umat(Md) ```
```M = 6x7 array of uncertain matrices with 4 rows, 5 columns, and no uncertain blocks. Type "M.NominalValue" to see the nominal value, "get(M)" to see all properties, and "M.Uncertainty" to interact with the uncertain elements. ```