Create Uncertain Real Parameters

This example shows how to create uncertain real parameters, modify properties such as range of uncertainty, and sample uncertain parameters.

Create an uncertain real parameter, nominal value 3, with default values for all unspecified properties (including plus/minus variability of 1).

a = ureal('a',3)
a =

  Uncertain real parameter "a" with nominal value 3 and variability [-1,1].

View the properties and their values, and note that the Range and Percentage descriptions of variability are automatically maintained.

get(a)
            Name: 'a'
    NominalValue: 3
            Mode: 'PlusMinus'
           Range: [2 4]
       PlusMinus: [-1 1]
      Percentage: [-33.3333 33.3333]
    AutoSimplify: 'basic'

Create an uncertain real parameter, nominal value 2, with 20% variability. Again, view the properties, and note that the Range and PlusMinus descriptions of variability are automatically maintained.

b = ureal('b',2,'Percentage',20)
get(b)
b =

  Uncertain real parameter "b" with nominal value 2 and variability [-20,20]%.

            Name: 'b'
    NominalValue: 2
            Mode: 'Percentage'
           Range: [1.6000 2.4000]
       PlusMinus: [-0.4000 0.4000]
      Percentage: [-20 20]
    AutoSimplify: 'basic'

Change the range of the parameter. All descriptions of variability are automatically updated, while the nominal value remains fixed. Although the change in variability was accomplished by specifying the Range, the Mode is unaffected, and remains Percentage.

b.Range = [1.9 2.3];
get(b)
            Name: 'b'
    NominalValue: 2
            Mode: 'Percentage'
           Range: [1.9000 2.3000]
       PlusMinus: [-0.1000 0.3000]
      Percentage: [-5.0000 15.0000]
    AutoSimplify: 'basic'

As mentioned, the Mode property signifies what aspect of the uncertainty remains unchanged when NominalValue is modified. Hence, if a real parameter is in Percentage mode, then the Range and PlusMinus properties are determined from the Percentage property and NominalValue. Changing NominalValue preserves the Percentage property, and automatically updates the Range and PlusMinus properties.

b.NominalValue = 2.2;
get(b)
            Name: 'b'
    NominalValue: 2.2000
            Mode: 'Percentage'
           Range: [2.0900 2.5300]
       PlusMinus: [-0.1100 0.3300]
      Percentage: [-5.0000 15.0000]
    AutoSimplify: 'basic'

Create an uncertain parameter with an asymmetric variation about its nominal value. Examine the properties to confirm the asymmetric range.

c = ureal('c',-5,'Percentage',[-20 30]);
get(c)
            Name: 'c'
    NominalValue: -5
            Mode: 'Percentage'
           Range: [-6 -3.5000]
       PlusMinus: [-1 1.5000]
      Percentage: [-20 30]
    AutoSimplify: 'basic'

Create an uncertain parameter, specifying variability with Percentage, but force the Mode to be Range.

d = ureal('d',-1,'Mode','Range','Percentage',[-40 60]);
get(d)
            Name: 'd'
    NominalValue: -1
            Mode: 'Range'
           Range: [-1.4000 -0.4000]
       PlusMinus: [-0.4000 0.6000]
      Percentage: [-40 60]
    AutoSimplify: 'basic'

Finally, create an uncertain real parameter, and set the AutoSimplify property to 'full'.

e = ureal('e',10,'PlusMinus',[-23],'Mode','Percentage','AutoSimplify','Full')
get(e)
e =

  Uncertain real parameter "e" with nominal value 10 and variability [-230,230]%.

            Name: 'e'
    NominalValue: 10
            Mode: 'Percentage'
           Range: [-13 33]
       PlusMinus: [-23 23]
      Percentage: [-230 230]
    AutoSimplify: 'full'

Specifying conflicting values for Range/Percentage/PlusMinus when creating a ureal element does not result in an error. In this case, the last specified property is used. This last occurrence also determines the Mode, unless Mode is explicitly specified, in which case that is used, regardless of the property/value pairs ordering.

f = ureal('f',3,'PlusMinus',[-2 1],'Percentage',40)
g = ureal('g',2,'PlusMinus',[-2 1],'Mode','Range','Percentage',40)
g.Mode
f =

  Uncertain real parameter "f" with nominal value 3 and variability [-40,40]%.


g =

  Uncertain real parameter "g" with nominal value 2 and range [1.2,2.8].


ans =

Range

Create an uncertain real parameter, use usample to generate 1000 instances (resulting in a 1-by-1-by-1000 array), reshape the array, and plot a histogram, with 20 bins (within the range of 2 to 4).

h = ureal('h',3);
hsample = usample(h,1000);
hist(reshape(hsample,[1000 1]),20);

Make the range unsymmetric about the nominal value, and repeat the sampling, and histogram plot (with 40 bins over the range of 2-to-6)

h.Range = [2 6];
hsample = usample(h,1000);
hist(reshape(hsample,[1000 1]),40);

Note that the distribution is skewed. However, the number of samples less than the nominal value and the number of samples greater than the nominal value are equal (on average). Verify this.

length(find(hsample(:) < h.NominalValue))
ans =

   482

length(find(hsample(:) > h.NominalValue))
ans =

   518

The distribution used in usample is uniform in the normalized description of the uncertain real parameter. See Decomposing Uncertain Objects to learn more about the normalized description.

There is no notion of an empty ureal (or any other uncertain element, for that matter). ureal, by itself, creates an element named 'UNNAMED', with default property values.

Was this topic helpful?