Matlab tril function does not work as expected
Show older comments
I am using Matlab2019a. When I was using tril an triu functions for generating triangular matrix, they ony give single values. Here are their function descriptions when type editing commdands:
tril Extract lower triangular part.
tril(X) is the lower triangular part of X.
tril(X,K) is the elements on and below the K-th diagonal
of X . K = 0 is the main diagonal, K > 0 is above the
main diagonal and K < 0 is below the main diagonal.
triu Extract upper triangular part.
triu(X) is the upper triangular part of X.
triu(X,K) is the elements on and above the K-th diagonal of
X. K = 0 is the main diagonal, K > 0 is above the main
diagonal and K < 0 is below the main diagonal.
When typing a simple command:
tril(4)
it gives a single value 4
Why the version of Matlab does not support the offiicially claimed functionalities (both introduced since 2006a) as described at https://www.mathworks.com/help/matlab/ref/triu.html and https://www.mathworks.com/help/matlab/ref/tril.html
1 Comment
James Tursa
on 12 Apr 2020
You are going to have to provide examples of why you think they don't work rather that just making a blanket statement.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!