This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create Arrays with usample

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 
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); 
UMAT: 3 Rows, 2 Columns [array, 20 x 1] 
  a: real, nominal = 4, variability = [-1  1], 2 occurrences 
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); 
ans = 
     3     2    20    15 
ans = 

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

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

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); 
ans = 
     3     2   800 
ans = 
   800     1 
Was this topic helpful?