tril

Purpose

Lower triangular part of a matrix.

Synopsis

L = tril(X)
L = tril(X,k)

Description

tril(X) is the lower triangular part of X.

tril(X,k) is the elements on and below the k-th diagonal of X. k = 0 is the main diagonal, k > 0 is above the main diagonal, and k < 0 is below the main diagonal.

Examples

tril(ones(4,4),-1) is

    0    0    0    0
    1    0    0    0
    1    1    0    0
    1    1    1    0

See Also

diag, triu

(c) Copyright 1994 by The MathWorks, Inc.