How to have Matlab create a random matrix that is fullrow rank?
Show older comments
Say we have random matrix A, which we use for proving some theory, and we need this matrix to be fullrow rank, how to model this in Matlab?
I have no numeric values, as I want to research the generality of the theory.
2 Comments
jessupj
on 24 Mar 2022
can you clarify what you mean by 'random' here? Requiring a rank imposes some constraint (e.g noncollinearity or something like that) on the entries, so they will coordinate with one another rather than being independent. I think this may be one of those things that you have to think out a strategy on paper first before trying to assemble it numerically.
DB
on 25 Mar 2022
Accepted Answer
More Answers (1)
Bruno Luong
on 29 Mar 2022
Edited: Bruno Luong
on 29 Mar 2022
Here is a way to generate finite condition number matrxix , meaning stronger than full rank, and it must give a full rank (unless randn(n) returns all 0s)
targetcond = 10; % must be > 1
n = 1000;
[U,S,V] = svd(randn(n,n), 0, 'vector');
Sc = ((targetcond-1)*S + S(1))/targetcond;
A = U*diag(Sc)*V';
% Check
cond(A)
1 Comment
Bruno Luong
on 29 Mar 2022
it is also possible to make targetcond random but bounded
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!