Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Verify if a matrix is upper triangular. Also if it is lower triangular
Replies: 4   Last Post: Nov 24, 2012 7:58 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.