Create an uncertain matrix MV in which the diagonal elements are the elements of an uncertain vector V, and the off-diagonal elements are all 0. First, create the uncertain vector V.
a = ureal('a',10);
b = ureal('b',5);
V = [1+a 2 3-b 4]
Uncertain matrix with 1 rows and 4 columns.
The uncertainty consists of the following blocks:
a: Uncertain real, nominal = 10, variability = [-1,1], 1 occurrences
b: Uncertain real, nominal = 5, variability = [-1,1], 1 occurrences
Model Properties
Type "V.NominalValue" to see the nominal value and "V.Uncertainty" to interact with the uncertain elements.
V is a 1-by-4 umat uncertain matrix, or in other words, an uncertain row vector with four elements. Create MV such that the diagonals of MV are the elements of V.
MV = diag(V)
Uncertain matrix with 4 rows and 4 columns.
The uncertainty consists of the following blocks:
a: Uncertain real, nominal = 10, variability = [-1,1], 1 occurrences
b: Uncertain real, nominal = 5, variability = [-1,1], 1 occurrences
Model Properties
Type "MV.NominalValue" to see the nominal value and "MV.Uncertainty" to interact with the uncertain elements.
To verify that MV is a diagonal matrix, examine its nominal value.
MV.NominalValue
ans = 4×4
11 0 0 0
0 2 0 0
0 0 -2 0
0 0 0 4
Next, create a matrix in which V forms the elements of the first diagonal below the main diagonal.
MV1 = diag(V,-1)
Uncertain matrix with 5 rows and 5 columns.
The uncertainty consists of the following blocks:
a: Uncertain real, nominal = 10, variability = [-1,1], 1 occurrences
b: Uncertain real, nominal = 5, variability = [-1,1], 1 occurrences
Model Properties
Type "MV1.NominalValue" to see the nominal value and "MV1.Uncertainty" to interact with the uncertain elements.
Obtain a vector by extracting the diagonal elements of an uncertain matrix. First, create an uncertain matrix.
a = ureal('a',10);
b = ureal('b',5);
M = [1+a 2 3+b; 4 5+a 6; 7 8 9]
Uncertain matrix with 3 rows and 3 columns.
The uncertainty consists of the following blocks:
a: Uncertain real, nominal = 10, variability = [-1,1], 2 occurrences
b: Uncertain real, nominal = 5, variability = [-1,1], 1 occurrences
Model Properties
Type "M.NominalValue" to see the nominal value and "M.Uncertainty" to interact with the uncertain elements.
M is a 3-by-3 uncertain matrix. Extract the diagonals of M into a three-element column vector.
VM = diag(M)
Uncertain matrix with 3 rows and 1 columns.
The uncertainty consists of the following blocks:
a: Uncertain real, nominal = 10, variability = [-1,1], 1 occurrences
Model Properties
Type "VM.NominalValue" to see the nominal value and "VM.Uncertainty" to interact with the uncertain elements.
VM is a 3-by-1 umat, or an uncertain column vector. Note that V depends only on the uncertain parameter a, because the diagonal elements of M do not depend on b.
Next, extract a vector containing the elements of the first diagonal below the main diagonal of M.
VM1 = diag(M,-1)
Uncertain matrix with 2 rows, 1 columns, and no uncertain blocks.
Model Properties
Type "VM1.NominalValue" to see the nominal value and "VM1.Uncertainty" to interact with the uncertain elements.
This vector contains no uncertain elements at all. Examine its values.
Uncertain vector, specified as a umat object with dimensions
1-by-N (row vector) or N-by-1 (column
vector).
Uncertain matrix, specified as a umat object.
Index of diagonal, specified as an integer. K = 0 represents
the main diagonal, K > 0 is above the main diagonal, and
K < 0 is below the main diagonal.
Uncertain diagonal matrix, returned as a umat object. The elements
of the input vector V form the Kth diagonal of
the matrix. If you omit K, then V forms the
main diagonal of the matrix. MV is a square matrix of order
length(V) + abs(K).
Uncertain column vector, returned as a umat object. The elements of
VM are the diagonal elements of the input matrix
M.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.