triu

Upper triangular part of matrix

Syntax

  • T = triu(M)

  • T = triu(M, k)

Input argument

  • M - 2D input matrix

  • k - Diagonals to include: integer real value

Output argument

  • R - Upper Triangular Portions of Matrix

Description

triu computes Upper Triangular Portions of Matrix.

R = triu(M, k) returns the elements on and above the kth diagonal of M.

Example

x = [1+i,-i;i,2i];
r = triu(x)

See also

diag.

History

Author

Allan CORNET

Last updated