FreeMat
TRIU Upper Triangular Matrix Function

Section: Array Generation and Manipulations

Usage

Returns the upper triangular matrix of a square matrix. The general syntax for its use is

   y = triu(x)

where x is a square matrix. This returns the upper triangular matrix (i.e.: all elements on or below the diagonal are set to 0). You can also specify a different diagonal using the alternate form

   y = triu(x,n)

where n is the diagonal offset. In this mode, the diagonal specified is not set to zero in the returned matrix (e.g.: tril(x) and tril(x,1)) will return the same value.