# umat

Create uncertain matrix

## Syntax

```M = umat(A) ```

## Description

Uncertain matrices are rational expressions involving uncertain elements of type `ureal`, `ucomplex`, or `ucomplexm`. Use uncertain matrices for worst-case gain analysis and for building uncertain state-space (`uss`) models.

Create uncertain matrices by creating uncertain elements and combining them using arithmetic and matrix operations. For example:

``` p = ureal('p',1); M = [0 p; 1 p^2]```

creates a 2-by-2 uncertain matrix (a `umat` object) with the uncertain parameter `p`.

The syntax `M = umat(A)` converts the double array `A` to a `umat` object with no uncertainty.

Most standard matrix manipulations are valid on uncertain matrices, including addition, multiplication, inverse, horizontal and vertical concatenation. Specific rows/columns of an uncertain matrix can be referenced and assigned also.

If `M` is a `umat`, then `M.NominalValue` is the result obtained by replacing each uncertain element in `M` with its own nominal value.

If `M` is a `umat`, then` M.Uncertainty` is an object describing all the uncertain elements in `M`. All element can be referenced and their properties modified with this `Uncertainty` gateway. For instance, if `B` is an uncertain real parameter in `M`, then `M.Uncertainty.B` accesses the uncertain element `B` in `M`.

## Examples

Create 3 uncertain elements and then a ` 3-by-2 umat`.

```a = ureal('a',5,'Range',[2 6]); b = ucomplex('b',1+j,'Radius',0.5); c = ureal('c',3,'Plusminus',0.4); M = [a b;b*a 7;c-a b^2] ```

`M` is an uncertain matrix (`umat` object) with the uncertain parameters `a`, `b`, and `c`.

View the properties of `M` with `get`

```get(M) ```

The nominal value of `M` is the result when all atoms are replaced by their nominal values.

```M.NominalValue ans = 5.0000 1.0000 + 1.0000i 5.0000 + 5.0000i 7.0000 -2.0000 0 + 2.0000i ```

Change the nominal value of `a` within `M` to 4. The nominal value of `M` reflects this change.

```M.Uncertainty.a.NominalValue = 4; M.NominalValue ans = 4.0000 1.0000 + 1.0000i 4.0000 + 4.0000i 7.0000 -1.0000 0 + 2.0000i ```

Get a random sample of `M`, obtained by taking random samples of the uncertain atoms within `M`.

```usample(M) ans = 2.0072 0.8647 + 1.3854i 1.7358 + 2.7808i 7.0000 1.3829 -1.1715 + 2.3960i ```

Select the 1st and 3rd rows, and the 2nd column of `M`. The result is a 2-by-1 `umat`, whose dependence is only on `b`.

```M([1 3],2) ```

## Version History

Introduced before R2006a