Evaluate Uncertain Elements by Substitution
You can make substitutions for uncertain elements in uncertain matrices and models using usubs
. Doing so is useful for evaluating uncertain objects at particular values of the uncertain parameters, or for sampling uncertain objects at multiple parameter values.
For example, create an uncertain matrix with three uncertain parameters.
a = ureal('a',3); b = ureal('b',10,'Percentage',20); c = ureal('c',3,'Percentage',40); M = [-a, 1/b; b, a+1/b; 1, c]
Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: a: Uncertain real, nominal = 3, variability = [-1,1], 2 occurrences b: Uncertain real, nominal = 10, variability = [-20,20]%, 3 occurrences c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M.NominalValue" to see the nominal value and "M.Uncertainty" to interact with the uncertain elements.
Substitute all instances of the uncertain real parameter a
with the value 4. This operation results in a umat
containing only two uncertain real parameters, b
and c
.
M2 = usubs(M,'a',4)
Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: b: Uncertain real, nominal = 10, variability = [-20,20]%, 3 occurrences c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M2.NominalValue" to see the nominal value and "M2.Uncertainty" to interact with the uncertain elements.
You can replace all instances of one uncertain real parameter with another. For example, replace all instances of b
in M
with the uncertain parameter a
. The resulting umat
contains only the parameters a
and c
, and has two additional occurrences of a
, compared to M
.
M3 = usubs(M,'b',M.Uncertainty.a)
Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: a: Uncertain real, nominal = 3, variability = [-1,1], 5 occurrences c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M3.NominalValue" to see the nominal value and "M3.Uncertainty" to interact with the uncertain elements.
Next, evaluate M
at the nominal value of a
and a random value of b
.
M4 = usubs(M,'a','NominalValue','b','Random')
Uncertain matrix with 3 rows and 2 columns. The uncertainty consists of the following blocks: c: Uncertain real, nominal = 3, variability = [-40,40]%, 1 occurrences Type "M4.NominalValue" to see the nominal value and "M4.Uncertainty" to interact with the uncertain elements.
Use the usample
command to generate multiple random instances of umat
, uss
, or ufrd
uncertain objects. See Generate Samples of Uncertain Systems for more information.
See Also
usubs
| usample
| umat
| uss
| ufrd