Please note that the recommended version of Scilab is 2023.1.0. This page might be outdated.
See the recommended documentation of this function
diagonal including or extracting
vector or matrix (full or sparse storage)
integer (default value 0)
vector or matrix
vm a (row or column) n-vector
diag(vm) returns a diagonal matrix with entries of
vm along the main diagonal.
diag(vm,k) is a
(n+abs(k))x(n+abs(k)) matrix with the entries of
vm along the kth diagonal.
the main diagonal
k>0 is for upper diagonals and
k<0 for lower diagonals.
For a matrix
the column vector made of entries of the kth diagonal of
diag(vm) is the main diagonal of
diag(diag(x)) is a diagonal
vm is a sparse matrix
diag(vm,k) returns a sparse matrix.
To construct a diagonal linear system, use
eye(A).*A returns a diagonal matrix
made with the diagonal entries of
A. This is valid for
any matrix (constant, polynomial, rational, state-space linear
|Report an issue|
|<< Elementary matrices||Elementary matrices||eye >>|