Symbolic Math Toolbox
  Go to function:
    Search    Help Desk 
triu    Examples   See Also

Symbolic upper triangle.

Syntax

Description

triu(X) is the upper triangular part of X.

triu(X, K) returns an upper triangular matrix that retains the elements of X on and above 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

Then triu(A) returns

triu(A,1) returns

triu(A,-1) returns

See Also

diag, tril



[ Previous | Help Desk | Next ]