How to get the numerical rank of the matrix in matlab?
16 views (last 30 days)
Show older comments
Jiapeng
on 22 Nov 2022
Commented: Bjorn Gustavsson
on 22 Nov 2022
Suppose there exists a 3*3 matrix A. I know I can use rank(A) to get the rank of A. However, if there exists ε>0, how should I use matlab to get the numerical rank, should I use sprank(A)?
1 Comment
Jan
on 22 Nov 2022
"However, if there exists ε>0, how should I use matlab" - this is not meaningful. sprank works for sparse matrices.
Use rank().
Accepted Answer
Bjorn Gustavsson
on 22 Nov 2022
If you can afford it you might consider looking at the singular vaules that you obtain from the svd of your A-matrix. That will allow you to judge how many singular values are sufficiently larger than ϵ or not too small compared to the larges singular value. That's how I judge how much information I can extract from a system of equations - if I can afford/manage the svd.
0 Comments
More Answers (1)
John D'Errico
on 22 Nov 2022
To compute the numerical rank of a matrix, use rank. Surely that seems logical. And you even know about rank.
Bu then you seem to be askign about what if you have a tolerance. But then surely, you should have read the help for rank! Rank accepts a tolerance as an option. So, while you COULD use svd, looking at the singular values, and comparing them carefully to your tolerance and how that all combines with the maximum singular vlaue, all you needed to use is rank in the first place. It already does the work for you, including alllowing you to provide a tolerance. (You do NOT just compare the small singular value to an absolute tolerance, as the largest singular value is hugely important here.)
help rank
1 Comment
Bjorn Gustavsson
on 22 Nov 2022
The justification for doing the svd is (in my mind) that that's how one typically should go about solving illposed mixed-determined problems with Tikhonov-requlatization (second-order if I can chose) anyway, then one always look at the singular-values, the Picard-condition and have a think about how noise will effect the choise of regularization-parameter. In my problems with a couple of 1000s unknowns it doesn't matter much if the rank of my measurement matrix is 4500 or 4400 - that will be floating with the noise-level between different RHS (data) of the problem.
Your answer is obviously the litterally correct one.
See Also
Categories
Find more on Linear Algebra 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!