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
Best Answer