tril
Lower triangular part of a matrix.
t=tril(a)
t=tril(a,k)
Inputs
a Any matrix.
k An integer.
Outputs
t The lower triangular part of a , or the 'pseudo' lower triangular part as defined below.


Description
The output is of the same size as a . If k is not specified, the output is a copy of the input except that all the elements in the upper triangular part, i.e. the elements of the type t[i,j] for i less than j are replaced by zeros in the output.

If k is specified to be positive, all the elements above the k'th super diagonal are zero in in the output, i.e., the elements of the type t[i,j],i<(j-k) are set to zero.

If k is specified to be negative, all the elements below the (-k)'th sub diagonal are zero in in the output, i.e., the elements of the type t[i,j],i<(j-k) are set to zero.
Example
>>a=[1 2 3 4;5 6 7 8; 9 10 11 12]
>>a
          1          2          3          4
          5          6          7          8
          9         10         11         12

>>tril(a)
          1          0          0          0
          5          6          0          0
          9         10         11          0

>>tril(a,1)
          1          2          0          0
          5          6          7          0
          9         10         11         12

>>tril(a,2)
          1          2          3          0
          5          6          7          8
          9         10         11         12
>>tril(a,-1)
          0          0          0          0
          5          0          0          0
          9         10          0          0