Effacer les filtres
Effacer les filtres

How to get the numerical rank of the matrix in matlab?

20 vues (au cours des 30 derniers jours)
Jiapeng le 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 commentaire
Jan le 22 Nov 2022
"However, if there exists ε>0, how should I use matlab" - this is not meaningful. sprank works for sparse matrices.
Use rank().

Connectez-vous pour commenter.

Réponse acceptée

Bjorn Gustavsson
Bjorn Gustavsson le 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.

Plus de réponses (1)

John D'Errico
John D'Errico le 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
RANK Matrix rank. RANK(A) provides an estimate of the number of linearly independent rows or columns of a matrix A. RANK(A,TOL) is the number of singular values of A that are larger than TOL. By default, TOL = max(size(A)) * eps(norm(A)). Class support for input A: float: double, single Documentation for rank doc rank Other uses of rank distributed/rank sym/rank symbolic/rank
  1 commentaire
Bjorn Gustavsson
Bjorn Gustavsson le 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.

Connectez-vous pour commenter.


En savoir plus sur Sparse Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by