triu

description:

B = triu(A,k) extracts upper triangular part of A.

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

triu(A,k) is the elements on and above the k-th diagonal of A. k = 0 is the main diagonal, k > 0 is above the main diagonal and k < 0 is below the main diagonal.

arguments:

A is a matrix of NCpolys

k is an integer

output:

matrix of NCpolys

possible usage:

triu(A), triu(A,k)

example:

>> A=[x x^2 x*y-y*x; y x*y 2*x-y; x+y y-x x^2+y^2]

A =  x    x^2   x*y-y*x

     y    x*y     2*x-y

   x+y   -x+y   x^2+y^2

>> triu(A)

ans = x   x^2   x*y-y*x

      0   x*y     2*x-y

      0     0   x^2+y^2

 

>> triu(A,-1)

ans = x    x^2   x*y-y*x

      y    x*y     2*x-y

      0   -x+y   x^2+y^2