Rank function returning two different values to the same matrix

5 ビュー (過去 30 日間)
Subash Chandar
Subash Chandar 2018 年 11 月 23 日
編集済み: David Goodmanson 2018 年 11 月 24 日
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.

回答 (1 件)

David Goodmanson
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.

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by