| MATLAB Function Reference | Search  Help Desk |
| tril | Examples See Also |
Lower triangular part of a matrix
L = tril(X) L = tril(X,k)
L = tril(X)
returns the lower triangular part of X.
L = tril(X,k)
returns the elements on and below the kth diagonal of X. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.
tril(ones(4,4),-1) is
0 0 0 0
1 0 0 0
1 1 0 0
1 1 1 0
diag Diagonal matrices and diagonals of a matrix
triu Upper triangular part of a matrix