Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Edwardo
Posts:
7
Registered:
11/24/12


Re: Verify if a matrix is upper triangular. Also if it is lower triangular
Posted:
Nov 24, 2012 7:04 PM


"Roger Stafford" wrote in message <k8ra04$pab$1@newscl01ah.mathworks.com>... > "Edwardo " <edwardo.rivera@upr.edu> wrote in message <k8r8qj$ljq$1@newscl01ah.mathworks.com>... > > ..... I want to test if a matrix is upper or lower triangular. >         > Let A be a square matrix. It is upper triangular if > > all(all(tril(A,1)==0)) > > is true. > > Roger Stafford
Hi, I made this:
function res = isupper(A) res = isequal(A,triu(A)); # verify if A is equal to the upper triangular matrix A. store the result in res. end
function res = islower(A) res = isequal(A,tril(A));# verify if A is equal to the lower triangular matrix A. store the result in res. end
this is ok right?



