An extremely common manner in which to generate an array is
to sample (in some of the uncertain elements) an uncertain object.
Using the `ureal`

objects `a`

and `b`

from
above, create a 2-by-3 `umat`

.

M = [a b;b*b a/b;1-b 1+a*b] UMAT: 3 Rows, 2 Columns a: real, nominal = 4, variability = [-1 1], 3 occurrences b: real, nominal = 2, variability = [-1 1], 6 occurrences size(M) ans = 3 2

Sample (at 20 random points within its range) the uncertain
real parameter `b`

in the matrix `M`

.
This results in a 3-by-2-by-20 `umat`

,
with only one uncertain element, `a`

The uncertain
element `b`

of `M`

has been "sampled
out", leaving a new array dimension in its place.

[Ms,bvalues] = usample(M,'b',20); Ms UMAT: 3 Rows, 2 Columns [array, 20 x 1] a: real, nominal = 4, variability = [-1 1], 2 occurrences size(Ms) ans = 3 2 20

Continue sampling (at 15 random points within its range) the
uncertain real parameter `a`

in the matrix `Ms`

.
This results in a 3-by-2-by-20-by-15 `double`

.

[Mss,avalues] = usample(Ms,'a',15); size(Mss) ans = 3 2 20 15 class(Mss) ans = double

The above 2-step sequence can be performed in 1 step,

[Mss,values] = usample(M,'b',20,'a',15); class(Mss) ans = double

In this case, `values`

is a 20-by-15 struct
array, with 2 fields `b`

and `a`

,
whose values are the values used in the random sampling. It follows
that `usubs(M,values)`

is the same as `Mss`

.

Rather than sampling the each variable (`a`

and `b`

)
independently, generating a 20-by-15 grid in a 2-dimensional space,
the two-dimensional space can be sampled. Sample the 2-dimensional
space with 800 points,

[Ms,values] = usample(M,{'a' 'b'},800); size(Ms) ans = 3 2 800 size(values) ans = 800 1

Was this topic helpful?