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]

V =
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
Type "V.NominalValue" to see the nominal value, "get(V)" to see all properties, 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)

MV =
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
Type "MV.NominalValue" to see the nominal value, "get(MV)" to see all properties, 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)

MV1 =
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
Type "MV1.NominalValue" to see the nominal value, "get(MV1)" to see all properties, 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]

M =
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
Type "M.NominalValue" to see the nominal value, "get(M)" to see all properties, 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)

VM =
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
Type "VM.NominalValue" to see the nominal value, "get(VM)" to see all properties, 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)

VM1 =
Uncertain matrix with 2 rows, 1 columns, and no uncertain blocks.
Type "VM1.NominalValue" to see the nominal value, "get(VM1)" to see all properties, 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).

M — Uncertain matrix umat object

Uncertain matrix, specified as a umat object.

K — Index of diagonal 0 (default) | integer

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).

VM — Uncertain column vector umat object

Uncertain column vector, returned as a umat object. The elements of
VM are the diagonal elements of the input matrix
M.

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.