Documentation |
If an uncertain object (umat, uss, ufrd) has many uncertain parameters, it is often necessary to freeze some, but not all, of the uncertain parameters to specific values. The usubs command accomplishes this, and also allows more complicated substitutions for an element.
usubs accepts a list of element names, and respective values to substitute for them. You can create three uncertain real parameters and use them to create a 2-by-2 uncertain matrix A.
delta = ureal('delta',2); eta = ureal('eta',6); rho = ureal('rho',-1); A = [3+delta+eta delta/eta;7+rho rho+delta*eta]
A = Uncertain matrix with 2 rows and 2 columns. The uncertainty consists of the following blocks: delta: Uncertain real, nominal = 2, variability = [-1,1], 2 occurrences eta: Uncertain real, nominal = 6, variability = [-1,1], 3 occurrences rho: Uncertain real, nominal = -1, variability = [-1,1], 1 occurrences Type "A.NominalValue" to see the nominal value, "get(A)" to see all properties, and "A.Uncertainty" to interact with the uncertain elements.
Use usubs to substitute the uncertain element named delta in A with the value 2.3, leaving all other uncertain elements intact. Note that the result, B, is an uncertain matrix with dependence only on eta and rho.
B = usubs(A,'delta',2.3)
B = Uncertain matrix with 2 rows and 2 columns. The uncertainty consists of the following blocks: eta: Uncertain real, nominal = 6, variability = [-1,1], 3 occurrences rho: Uncertain real, nominal = -1, variability = [-1,1], 1 occurrences Type "B.NominalValue" to see the nominal value, "get(B)" to see all properties, and "B.Uncertainty" to interact with the uncertain elements.
To set multiple elements, list individually, or group the values in a data structure. For instance, the following are the same.
B1 = usubs(A,'delta',2.3,'eta',A.Uncertainty.rho); S.delta = 2.3; S.eta = A.Uncertainty.rho; B2 = usubs(A,S);
In each case, delta is replaced by 2.3, and eta is replaced by A.Uncertainty.rho.
Any superfluous substitution requests are ignored. Hence, the following returns an uncertain model that is the same as A.
B4 = usubs(A,'fred',5);
An alternative syntax for usubs is to specify the substituted values in a structure, whose fieldnames are the names of the elements being substituted with values.
Create a structure NV with 2 fields, delta and eta. Set the values of these fields to be the desired substituted values. Then perform the substitution with usubs.
NV.delta = 2.3; NV.eta = A.Uncertainty.rho; B6 = usubs(A,NV);
Here, B6 is the same as B1 and B2 above. Again, any superfluous fields are ignored. Therefore, adding an additional field gamma to NV, and substituting does not alter the result.
NV.gamma = 0; B7 = usubs(A,NV);
Here, B7 is the same as B6.
The commands wcgain, robuststab and usample all return substitutable values in this structure format. More discussion can be found in Create Arrays with usubs.
If the replacement value is the (partial and case-independent) string 'Nominal', then the listed element are replaced with their nominal values. Therefore
B8 = usubs(A,fieldnames(A.Uncertainty),'nom')
B8 = 11.0000 0.3333 6.0000 11.0000
B9 = A.NominalValue
B9 = 11.0000 0.3333 6.0000 11.0000
are the same. It is possible to only set some of the elements to NominalValues, and would be the typical use of usubs with the 'nominal' argument.
Within A, set eta to its nominal value, delta to a random value (within its range) and rho to a specific value, say 6.5
B10 = usubs(A,'eta','nom','delta','rand','rho',6.5)
B10 = 10.5183 0.2531 13.5000 15.6100
Unfortunately, the 'nominal' and 'Random' specifiers may not be used in the structure format. However, explicitly setting a field of the structure to an element's nominal value, and then following (or preceeding) the call to usubs with a call to usample (to generate the random samples) is acceptable, and achieves the same effect.