Main Content

# ureal

Uncertain real parameter

## Description

Use the `ureal` uncertain element to represent real numbers whose values are uncertain when modeling dynamic systems with uncertainty. An uncertain real parameter has a nominal value, stored in the `NominalValue` property, and an uncertainty, which is the potential deviation from the nominal value. `ureal` stores this deviation equivalently in three different properties:

• `PlusMinus` — The additive relative deviation from `NominalValue`

• `Range` — The absolute range of values, expressed as an interval containing `NominalValue`

• `Percentage` — The deviation, expressed as a percentage of `NominalValue`

When you create an uncertain real parameter, you can specify the uncertainty in any of these three ways. The `ureal` object automatically calculates the appropriate values for the other two properties.

You can combine `ureal` uncertain parameters with numeric parameters to create uncertain matrices (`umat` objects) which you can then use to create uncertain state-space models. Or, you can use them as coefficients in transfer functions. When you use uncertain real parameters to build uncertain dynamic systems, the result is an uncertain model such as a `uss` or `genss` model.

## Creation

### Syntax

``p = ureal(name,nominalvalue)``
``p = ureal(name,nominalvalue,'PlusMinus',plusminus)``
``p = ureal(name,nominalvalue,'Range',range)``
``p = ureal(name,nominalvalue,'Percentage',percentage)``
``p = ureal(name,nominalvalue,___,Name,Value)``

### Description

````p = ureal(name,nominalvalue)` creates an uncertain real parameter with the specified nominal value and an uncertainty of ±1. This syntax sets the `Name` and `NominalValue` properties of the resulting `ureal` object.```

example

````p = ureal(name,nominalvalue,'PlusMinus',plusminus)` sets the uncertainty to the specified deviations from the nominal value. `plusminus` is a two-element vector of the form `[-DL,DR]`. The uncertain parameter takes values in the range `[nominalvalue-DL,nominalvalue+DR]`. If the range is symmetric around the nominal value such that `DL = DR`, you can use `plusminus`` = DR`. Using this syntax also sets the `Mode` property of the resulting `ureal` object to `'PlusMinus'`. ```

example

````p = ureal(name,nominalvalue,'Range',range)` sets the uncertainty to the specified absolute range. `range` is a two-element vector of the form `[LOW,HIGH]`, and the nominal value must fall in this range. Using this syntax also sets the `Mode` property of the resulting `ureal` object to `'Range'`. ```

example

````p = ureal(name,nominalvalue,'Percentage',percentage)` sets the uncertainty in terms of percentage deviations from the nominal value. `percentage` is a two-element vector of the form `[-PL,PR]`. This syntax sets the lower and upper limits of the uncertainty range such that `PL = 100*|1-LOW/nominalvalue|` and `PR = 100*|1-HIGH/nominalvalue|`.Using this syntax also sets the `Mode` property of the resulting `ureal` object to `'Percentage'`. ```
````p = ureal(name,nominalvalue,___,Name,Value)` sets additional properties using name-value pairs. You can specify multiple name-value pairs. Enclose each property name in single quotes.```

## Properties

expand all

Nominal value of the uncertain parameter, specified as a real scalar.

Independent quantification of uncertainty, specified as `'PlusMinus'`, `'Range'`, or `'Percentage'`. The `ureal` object stores the uncertainty as a relative deviation from nominal, an absolute range of possible values, and a percentage deviation from nominal. This property specifies which of these three ways of expressing the uncertainty is independent of the nominal value. For instance, if `p.Mode = 'Range'`, then changing the nominal value has no effect on `p.Range`, but does change the value of both `p.PlusMinus` and `p.Percentage`.

The initial value of this property depends on how you create the `ureal` object. For instance, the following code creates `pl` with `p1.Mode = 'PlusMinus'` and `p2` with `p2.Mode = 'Percentage'`.

```p1 = ureal('p1',2); p2 = ureal('p2',2,'Percentage',[-10 20]); ```

Range of variation of the uncertain parameter, specified as a two-element vector of the form `[LOW,HIGH]`, where `LOW` and `HIGH` are real scalars. The uncertain parameter can take any value within this range. The nominal value must fall within this range.

Deviation from nominal value, specified as a two-element vector of the form `[-DL,DR]`, where `DL` and `DR` are real positive scalars. The uncertain parameter can take any value in the range `[NominalValue-DL,NominalValue+DR]`. If you do not specify the uncertainty in any form when you create the `ureal` parameter, then the default uncertainty is `PlusMinus = [-1,1]`.

Percentage deviation from nominal value, specified as a two-element vector of the form `[-PL,PR]`, where `PL` and `PR` are real positive scalars. These values set the range of uncertainty such that `PL = 100*|1-LOW/NominalValue|` and ```PR = 100*|1-HIGH/NominalValue|```, where `[LOW,HIGH]` is the value of the `Range` property.

Block simplification level, specified as `'basic'`, `'full'`, or `'off'`. In general, when you combine uncertain elements to create uncertain state-space models, the software automatically applies techniques to eliminate redundant copies of the uncertain elements. (See `simplify`.) Use this property to specify the simplification to apply when you use model arithmetic or interconnection techniques with the uncertain block.

• `'basic'` — Apply the elementary simplification method after each arithmetical or interconnection operation.

• `'full'` — Apply techniques similar to model reduction.

• `'off'` — Perform no simplification.

Name of the uncertain element, specified as a character vector. When you create an uncertain model or uncertain matrix using uncertain control design blocks, the software tracks the blocks using the name you specify in this property, not the variable name in the MATLAB® workspace. For example, use the following code to create a `ureal` parameter and an uncertain dynamic system model.

```p1 = ureal('w0',10); sys = tf(p1,[1 p1])```
```sys = Uncertain continuous-time state-space model with 1 outputs, 1 inputs, 1 states. The model uncertainty consists of the following blocks: w0: Uncertain real, nominal = 10, variability = [-1,1], 1 occurrences```

The `Blocks` property of the resulting `uss` model lists the uncertain control design block using `w0`, which is the `Name` property of the uncertain parameter used to create `sys`.

## Object Functions

You can use `ureal` parameters with functions for creating dynamic systems such as `tf` and `ss`. You can also combine them with existing dynamic systems models using model arithmetic or commands such as `feedback`. Doing so creates an uncertain state-space model. You can also combine `ureal` parameters using common arithmetic operations, which generally results in an uncertain matrix (`umat` object). Use functions such as `actual2normalized` and `uscale` to transform or scale the amount of uncertainty in a `ureal` parameter. You can also use commands such as `usample` or `usubs` to replace real parameters with fixed values. The `gridureal` command evaluates a `ureal` parameter over its range and returns a grid of sampled values.

The following list contains a representative subset of the functions you can use with `ureal` parameter objects.

 `actual2normalized` Transform actual values to normalized values `append` Group models by appending their inputs and outputs `feedback` Feedback connection of multiple models `get` Access model property values `getLimits` Validity range for uncertain real (`ureal`) parameters `getNominal` Nominal value of uncertain model `gridureal` Grid `ureal` parameters uniformly over their range `isuncertain` Check whether argument is uncertain class type `normalized2actual` Convert value for atom in normalized coordinates to corresponding actual value `replaceBlock` Replace or update control design blocks in generalized LTI model `rsampleBlock` Randomly sample Control Design blocks in generalized model `sampleBlock` Sample Control Design blocks in generalized model `ss` State-space model `tf` Transfer function model `umat` Create uncertain matrix `usample` Generate random samples of uncertain or generalized model `uscale` Scale uncertainty of block or system `usubs` Substitute given values for uncertain elements of uncertain objects

## Examples

collapse all

Create an uncertain real parameter with a nominal value of 10, and an uncertainty range of ±2. Because this uncertainty is symmetric, you can specify it by setting `PlusMinus` to 2, instead of explicitly setting it to `[-2,2]`.

`p1 = ureal('p1',10,'PlusMinus',2)`
```p1 = Uncertain real parameter "p1" with nominal value 10 and variability [-2,2]. ```

Create another parameter with a nominal value of 10, this time with an asymmetric uncertainty such that the value can decrease by 2 from the nominal but can increase by 5.

`p2 = ureal('p2',10,'PlusMinus',[-2 5])`
```p2 = Uncertain real parameter "p2" with nominal value 10 and variability [-2,5]. ```

Examine the properties of the parameter. The `Range` and `Percentage` properties are automatically set to values corresponding to this variability.

`get(p2)`
``` NominalValue: 10 Mode: 'PlusMinus' Range: [8 15] PlusMinus: [-2 5] Percentage: [-20 50] AutoSimplify: 'basic' Name: 'p2' ```

Because you specified `PlusMinus` to create the parameter, the `Mode` property initializes to `PlusMinus`. In this mode, when you change the nominal value, `PlusMinus` remains fixed, while `Percentage` and `Range` change to reflect the new range of values the parameter can take. See Change Nominal Value or Uncertainty of Existing Parameter.

Create an uncertain real parameter whose value can vary from 14 to 19, with a nominal value of 15.5. To do so, set the `Range` property to the lowest and highest values the parameter can take.

`p1 = ureal('p1',15.5,'Range',[14,19])`
```p1 = Uncertain real parameter "p1" with nominal value 15.5 and range [14,19]. ```

Examine the properties of the parameter. The `PlusMinus` and `Percentage` properties are automatically set to the corresponding values. The `Mode` property is set to `'Range'`.

`get(p1)`
``` NominalValue: 15.5000 Mode: 'Range' Range: [14 19] PlusMinus: [-1.5000 3.5000] Percentage: [-9.6774 22.5806] AutoSimplify: 'basic' Name: 'p1' ```

Create an uncertain real parameter with a nominal value of 24, whose value can increase or decrease by 15%. Because this uncertainty is symmetric, you can specify it by setting `Percentage` to 15, instead of explicitly setting it to `[-15,15]`.

`p1 = ureal('p1',24,'Percentage',15)`
```p1 = Uncertain real parameter "p1" with nominal value 24 and variability [-15,15]%. ```

Create another parameter with a nominal value of 24, this time with an asymmetric uncertainty such that the value can decrease by 20% from the nominal but can increase by 15%.

`p2 = ureal('p2',24,'Percentage',[-20,15])`
```p2 = Uncertain real parameter "p2" with nominal value 24 and variability [-20,15]%. ```

Examine the properties to see the deviation from nominal (`PlusMinus`) and the range of values (`Range`) represented by these percentage variations.

`get(p2)`
``` NominalValue: 24 Mode: 'Percentage' Range: [19.2000 27.6000] PlusMinus: [-4.8000 3.6000] Percentage: [-20 15] AutoSimplify: 'basic' Name: 'p2' ```

A `ureal` parameter stores the uncertainty as a relative deviation from nominal (`PlusMinus`), an absolute range of possible values (`Range`), and a percentage deviation from nominal (`Percentage`). The `Mode` property specifies which of these three does not change when you change the nominal value of the parameter. For instance, create a parameter with a nominal value of 10 and a relative deviation of ±2.

`p1 = ureal('p1',10,'PlusMinus',[-2,2])`
```p1 = Uncertain real parameter "p1" with nominal value 10 and variability [-2,2]. ```

Examine the values of the other properties.

`get(p1)`
``` NominalValue: 10 Mode: 'PlusMinus' Range: [8 12] PlusMinus: [-2 2] Percentage: [-20 20] AutoSimplify: 'basic' Name: 'p1' ```

In `PlusMinus` mode, when you change the nominal value, the `PlusMinus` property remains fixed, and the values of the other two ways of expressing the uncertainty are updated to reflect the new values. For instance, change the nominal value to 20.

```p1.NominalValue = 20; get(p1)```
``` NominalValue: 20 Mode: 'PlusMinus' Range: [18 22] PlusMinus: [-2 2] Percentage: [-10 10] AutoSimplify: 'basic' Name: 'p1' ```

The new uncertain parameter has the same `PlusMinus` value, but the range and percentage are adjusted to the new values that correspond to 20±2.

If you change the `PlusMinus` value, the `Range` and `Percentage` values are updated to reflect the new uncertainties. The nominal value is unchanged.

```p1.PlusMinus = [-4 4]; get(p1)```
``` NominalValue: 20 Mode: 'PlusMinus' Range: [16 24] PlusMinus: [-4 4] Percentage: [-20 20] AutoSimplify: 'basic' Name: 'p1' ```

Next, change the parameter to `Range` mode. In this mode, when you change the nominal value, `Range` remains fixed at `[16 24]`, while `Percentage` and `PlusMinus` are updated.

```p1.Mode = 'Range'; p1.NominalValue = 22; get(p1)```
``` NominalValue: 22 Mode: 'Range' Range: [16 24] PlusMinus: [-6 2] Percentage: [-27.2727 9.0909] AutoSimplify: 'basic' Name: 'p1' ```

Create a model of a second-order system with natural frequency of ${\omega }_{0}$ = 10±3 rad/s and a damping ratio that can vary from 0.5 to 0.8, with a nominal value of ζ = 0.6.

First, represent the natural frequency and damping ratio values as uncertain real parameters.

```w0 = ureal('w0',10,'PlusMinus',[-3 3]); zeta = ureal('zeta',0.6,'Range',[0.5 0.8]);```

Next, use the parameters to specify the coefficients of a transfer function.

`sys = tf(1,[1/w0^2 2*zeta/w0 1])`
```sys = Uncertain continuous-time state-space model with 1 outputs, 1 inputs, 2 states. The model uncertainty consists of the following blocks: w0: Uncertain real, nominal = 10, variability = [-3,3], 3 occurrences zeta: Uncertain real, nominal = 0.6, range = [0.5,0.8], 1 occurrences Type "sys.NominalValue" to see the nominal value, "get(sys)" to see all properties, and "sys.Uncertainty" to interact with the uncertain elements. ```

`sys` is an uncertain state-space (`uss`) model that depends on the uncertain parameters `w0` and `zeta`. The model `sys` uses the `Name` property of the parameters to refer to them and track them.

Examine the step response of the system to get a sense of the responses that the uncertainty represents. The `step` command automatically takes a number of random samples of an uncertain system.

`step(sys,sys.NominalValue)` You can use `ureal` parameters to specify uncertain elements in state-space matrices. For instance, create three uncertain real parameters and build state-spaces matrices from them.

```p1 = ureal('p1',10,'Percentage',50); p2 = ureal('p2',3,'PlusMinus',[-.5 1.2]); p3 = ureal('p3',0); A = [-p1 p2; 0 -p1]; B = [-p2; p2+p3]; C = [1 0; 1 1-p3]; D = [0; 0];```

The matrices constructed with uncertain parameters, A, B, and C, are uncertain matrix (`umat`) objects. Using them as inputs to `ss` results in a 2-output, 1-input, 2-state uncertain system.

`sys = ss(A,B,C,D)`
```sys = Uncertain continuous-time state-space model with 2 outputs, 1 inputs, 2 states. The model uncertainty consists of the following blocks: p1: Uncertain real, nominal = 10, variability = [-50,50]%, 2 occurrences p2: Uncertain real, nominal = 3, variability = [-0.5,1.2], 2 occurrences p3: Uncertain real, nominal = 0, variability = [-1,1], 2 occurrences Type "sys.NominalValue" to see the nominal value, "get(sys)" to see all properties, and "sys.Uncertainty" to interact with the uncertain elements. ```

The display shows that the system includes the three uncertain parameters, referenced by the `Name` properties of the `ureal` objects you used to create the system.

## Tips

• `ureal` objects support uncertainty that is skewed, or asymmetric around the nominal value. However, highly skewed ranges can lead to poor numeric conditioning and poor results. Therefore, for meaningful results, avoid highly skewed ranges where the nominal value is orders of magnitude closer to one end of the range than to the other.

When the uncertainty range of a `ureal` parameter is not centered at its nominal value, the parameter can take only a restricted range of values. For robust stability analysis, which sometimes requires assigning a parameter values outside the specified range, these restrictions mean that the smallest destabilizing perturbation of the parameter might be outside the actual range of values that the parameter can take. Use `getLimits` to find the restricted range of values that a skewed `ureal` parameter can take. For more information, see `getLimits`.

## Compatibility Considerations

expand all

Behavior changed in R2020a

## See Also

### Topics

Introduced before R2006a

## Support Get trial now