tril - Symbolic lower triangle

Syntax

tril(X)
tril(X,K)

Description

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

tril(X,K) returns a lower triangular matrix that retains the elements of X on and below the k-th diagonal and sets the remaining elements to 0. The values k=0, k>0, and k<0 correspond to the main, superdiagonals, and subdiagonals, respectively.

Examples

Suppose

A =
[   a,   b,   c ]
[   1,   2,   3 ]
[ a+1, b+2, c+3 ]

Then tril(A) returns

[   a,   0,   0 ]
[   1,   2,   0 ]
[ a+1, b+2, c+3 ]

tril(A,1) returns

[   a,   b,   0 ]
[   1,   2,   3 ]
[ a+1, b+2, c+3 ]

tril(A,-1) returns

[   0,   0,   0 ]
[   1,   0,   0 ]
[ a+1, b+2,   0 ]

See Also

diag, triu

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS