Main Content
tril
Return lower triangular part of symbolic matrix
Description
tril(
returns a triangular matrix that
retains the lower part of the matrix A
)A
. The upper triangle of the
resulting matrix is padded with zeros.
Examples
Lower Triangular Part of Symbolic Matrix
Display the matrix retaining only the lower triangle of the original symbolic matrix:
syms a b c A = [a b c; 1 2 3; a + 1 b + 2 c + 3]; tril(A)
ans = [ a, 0, 0] [ 1, 2, 0] [ a + 1, b + 2, c + 3]
Triangular Matrix On and Below Specified Superdiagonal
Display the matrix that retains the elements of the original symbolic matrix on and below the first superdiagonal:
syms a b c A = [a b c; 1 2 3; a + 1 b + 2 c + 3]; tril(A, 1)
ans = [ a, b, 0] [ 1, 2, 3] [ a + 1, b + 2, c + 3]
Triangular Matrix On and Below Specified Subdiagonal
Display the matrix that retains the elements of the original symbolic matrix on and below the first subdiagonal:
syms a b c A = [a b c; 1 2 3; a + 1 b + 2 c + 3]; tril(A, -1)
ans = [ 0, 0, 0] [ 1, 0, 0] [ a + 1, b + 2, 0]
Input Arguments
Version History
Introduced before R2006a