Rank function returning two different values to the same matrix
조회 수: 5 (최근 30일)
이전 댓글 표시
a=rank(rand(100,24))
b=rank(rand(100,1)*rand(1,24))
a=24
b=1
I just wonder why the value of b is 1 and not 24. Thanks in advance.
댓글 수: 0
답변 (1개)
David Goodmanson
2018년 11월 23일
편집: David Goodmanson
2018년 11월 24일
Hi Subash,
It's not the same construction process at all. Try it with smaller numbers, and integers:
m = 5;
n = 4;
A = randi(10,m,n)
b = randi(10,m,1)
c = randi(10,1,n)
B=b*c
A =
3 5 8 2
4 7 6 1
2 6 10 5
10 7 3 5
7 6 2 4
b =
8
7
8
10
10
c = 2 2 7 1
B =
16 16 56 8
14 14 49 7
16 16 56 8
20 20 70 10
20 20 70 10
matrix A is a set of random integers, and it so happens that its four rows are linearly independent, so rank = 4. (Usually, but not always, matrices with integer random number entries have the largest possible rank).
Matrix B is an outer product of a column vector and a row vector, and consequently all its rows are multiples of each other. (I picked an example where all rows are obvious integer multiples of row 4). There is only one independent column vector here, so the rank is 1.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!