diag
Get diagonal elements of matrix or create diagonal matrix.
Syntax
D = diag(V)
X = diag(A)
D = diag(V, k)
X = diag(A, k)
Input argument
V - Diagonal elements
A - Input matrix
Output argument
D - vector
X - matrix
Description
diag returns diagonal elements of matrix or create diagonal matrix.
Example
See also
ones.
History
Author
Allan CORNET
Last updated