Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

tril

Return lower triangular part of symbolic matrix

Syntax

tril(A)
tril(A,k)

Description

tril(A) returns a triangular matrix that retains the lower part of the matrix A. The upper triangle of the resulting matrix is padded with zeros.

tril(A,k) returns a matrix that retains the elements of A on and below the k-th diagonal. The elements above the k-th diagonal equal to zero. The values k = 0, k > 0, and k < 0 correspond to the main, superdiagonals, and subdiagonals, respectively.

Examples

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]

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]

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]

See Also

|

Introduced before R2006a

Was this topic helpful?