Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
error in rank of matrices

Subject: error in rank of matrices

From: Lin

Date: 16 Feb, 2009 14:32:01

Message: 1 of 5

when i compute the rank of 2 matrices, i cannot get the desired result.

for example:

rank ([1;0],[0;1])

the obtained result is 0.

why is it so? The correct result should be 2.

can anyone help me in this? Thank you.

Subject: error in rank of matrices

From: Matt Fig

Date: 16 Feb, 2009 14:43:02

Message: 2 of 5

I suggest you read the help for rank.




^ippd]#]k<]#k{kjpcegrku^{kh6a]d{{{ak]jah{UeaIA_{ldi{l]qq*]_

Subject: error in rank of matrices

From: Lin

Date: 16 Feb, 2009 15:00:04

Message: 3 of 5

"Matt Fig" <spamanon@yahoo.com> wrote in message <gnbu1m$h61$1@fred.mathworks.com>...
> I suggest you read the help for rank.
> ^ippd]#]k<]#k{kjpcegrku^{kh6a]d{{{ak]jah{UeaIA_{ldi{l]qq*]_

After reading the help, i rewrote my codes to something as follows,
tr1 = [0;1];
tr2 = [1;0];
r1 = [tr1 tr2];
y = rank (r1);

If the code is written in that manner, i will obtain the correct result. Is this the only way? Or am i on the wrong direction?

Subject: error in rank of matrices

From: Bruno Luong

Date: 16 Feb, 2009 16:07:02

Message: 4 of 5

"Lin " <shenqlv@yahoo.com> wrote in message <gnbv1k$lgn$1@fred.mathworks.com>...
> "Matt Fig" <spamanon@yahoo.com> wrote in message <gnbu1m$h61$1@fred.mathworks.com>...
> > I suggest you read the help for rank.
> > ^ippd]#]k<]#k{kjpcegrku^{kh6a]d{{{ak]jah{UeaIA_{ldi{l]qq*]_
>
> After reading the help, i rewrote my codes to something as follows,
> tr1 = [0;1];
> tr2 = [1;0];
> r1 = [tr1 tr2];
> y = rank (r1);
>
> If the code is written in that manner, i will obtain the correct result. Is this the only way? Or am i on the wrong direction?

You can try:

y = rank([0 1; 1 0])

One matrix entity is within the bracket [...].

When you write rank([...], [...]), you actually provides two input parameters to RANK, each is a matrix.

This is just one of a syntax subtlety that you need to get use when learning Matlab.

Bruno

Subject: error in rank of matrices

From: Lin

Date: 16 Feb, 2009 17:00:05

Message: 5 of 5

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gnc2v6$6gg$1@fred.mathworks.com>...
> "Lin " <shenqlv@yahoo.com> wrote in message <gnbv1k$lgn$1@fred.mathworks.com>...
> > "Matt Fig" <spamanon@yahoo.com> wrote in message <gnbu1m$h61$1@fred.mathworks.com>...
> > > I suggest you read the help for rank.
> > > ^ippd]#]k<]#k{kjpcegrku^{kh6a]d{{{ak]jah{UeaIA_{ldi{l]qq*]_
> >
> > After reading the help, i rewrote my codes to something as follows,
> > tr1 = [0;1];
> > tr2 = [1;0];
> > r1 = [tr1 tr2];
> > y = rank (r1);
> >
> > If the code is written in that manner, i will obtain the correct result. Is this the only way? Or am i on the wrong direction?
>
> You can try:
>
> y = rank([0 1; 1 0])
>
> One matrix entity is within the bracket [...].
>
> When you write rank([...], [...]), you actually provides two input parameters to RANK, each is a matrix.
>
> This is just one of a syntax subtlety that you need to get use when learning Matlab.
>
> Bruno

THanks Matt and Bruno for ur replies. I will look into that.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us