DIAG matrix function


DIAG(A) Creates a diagonal matrix. The matrix argument can be either a numeric square matrix or a vector.

If matrix A is a square matrix, the DIAG function creates a column vector with its elements er equal to the corresponding diagonal elements er,r of A.

If matrix A is a vector, the DIAG function creates a matrix with diagonal elements er,r that are the values er in the vector. All off-diagonal elements are zeros.




See also

This site uses cookies to store information on your computer. More info...