Method on @sym: triu (A)
Method on @sym: triu (A, k)

Upper-triangular part of a symbolic matrix.

Example:

A = sym([1 2 3; 4 5 6; 7 8 9])
  ⇒ A = (sym 3×3 matrix)
      ⎡1  2  3⎤
      ⎢       ⎥
      ⎢4  5  6⎥
      ⎢       ⎥
      ⎣7  8  9⎦

triu(A)
  ⇒ (sym 3×3 matrix)
      ⎡1  2  3⎤
      ⎢       ⎥
      ⎢0  5  6⎥
      ⎢       ⎥
      ⎣0  0  9⎦

triu(A, 1)
  ⇒ (sym 3×3 matrix)
      ⎡0  2  3⎤
      ⎢       ⎥
      ⎢0  0  6⎥
      ⎢       ⎥
      ⎣0  0  0⎦

See also: @sym/tril.

Package: symbolic