Clear Filters
Clear Filters

'Rank' function

17 views (last 30 days)
Ahmad Karnama
Ahmad Karnama on 6 Mar 2012
I am wondering what is the output of 'rank' function in Matlab: For example:
>> A=[1 2 1 4; 2 3 1 3; 3 2 1 2; 4 3 1 1] A = 1 2 1 4 2 3 1 3 3 2 1 2 4 3 1 1 >> rank(A) ans = 3
and
>> rank(A(:,[1 2 3])) ans = 3
but
>> rank(A(:,[1 2 4])) ans = 3
and
>> rank(A(:,[1 3 4])) ans = 2
and
>> rank(A(:,[2 3 4])) ans = 3
Thanks in advance if someone tell me what are the output numbers?

Answers (3)

Thomas
Thomas on 6 Mar 2012
doc rank
The rank function provides an estimate of the number of linearly independent rows or columns of a full matrix.
k = rank(A) returns the number of singular values of A that are larger than the default tolerance, max(size(A))*eps(norm(A)).
k = rank(A,tol) returns the number of singular values of A that are larger than tol

Ahmad Karnama
Ahmad Karnama on 6 Mar 2012
Thanks Thomas! I read this on the website and matlab help but I am wondering it it estimated the linearly independent 'rows' or 'columns'?? and how can you interpret the results I am getting? Regards, Ahmad
  1 Comment
Thomas
Thomas on 6 Mar 2012
A
A =
1.00 2.00 1.00 4.00
2.00 3.00 1.00 3.00
3.00 2.00 1.00 2.00
4.00 3.00 1.00 1.00
>> A(:,[2 3 4])
ans =
2.00 1.00 4.00
3.00 1.00 3.00
2.00 1.00 2.00
3.00 1.00 1.00
>> A(:,[1 2 3])
ans =
1.00 2.00 1.00
2.00 3.00 1.00
3.00 2.00 1.00
4.00 3.00 1.00
>> rank(A(:,[1 2 3]))
ans =
3.00
A(:,[1 2 3]) gives a new matrix with col 1,2 and 3 from A
and
rank(A(:,[1 2 3]))
ans =
3.00
gives the rank of this new matrix..

Sign in to comment.


Jan
Jan on 6 Mar 2012
A = [1 2 1 4; 2 3 1 3; 3 2 1 2; 4 3 1 1]
rank(A) ans = 3
This means, that A has 3 independend rows or columns.
rank(A(:,[1 2 3])) ans = 3
The first three columns are independent.
rank(A(:,[1 2 4])) ans = 3
The columns 1,2,3 are also independent.
rank(A(:,[1 3 4])) ans = 2
One vector of this set is a linear combination of the two others.
rank(A(:,[2 3 4])) ans = 3
These three columns are independent again.
This is only the application of the definition Thomas has given already. Therefore I do not understand the problem.

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!