# Rank of symbolic matrix is wrong (but too small, not too large)

4 visualizaciones (últimos 30 días)
creepydog el 4 de Ag. de 2021
Comentada: Walter Roberson el 21 de Mzo. de 2022
I get a wrong result using the sym/rank command. I'm aware of the limitations of this command as it does not simplify expressions (see: doc sym/rank). So it might fail to recognize linear dependencies and therefore overestimate the rank.
But in my example it computes a too low rank. sym/rank finds a singularity where there is none.
Consider this symbolic 3x3 matrix S:
clear
pi = sym(pi);
syms phi real
S = [cos(phi) cos(phi - 2*pi/3) cos(phi - 4*pi/3)
sin(phi) sin(phi - 2*pi/3) sin(phi - 4*pi/3)
1 1 1];
At the command line:
>> S
S =
[cos(phi), cos(phi - (2*pi)/3), cos(phi - (4*pi)/3)]
[sin(phi), sin(phi - (2*pi)/3), sin(phi - (4*pi)/3)]
[ 1, 1, 1]
This matrix is always regular (i.e. for any value of phi). This can be shown by computing the determinant of S, which is non-zero (and independent of phi).
>> simplify(det(S))
ans =
-(3*3^(1/2))/2
But the rank command returns 2 (should be 3):
>> rank(S)
ans =
2
inv(S) computes the correct inverse of S without any problem. Also try simplify(inv(S)*S), which returns the identity matrix as expected.
I've tested this on R2016b, R2018b, R2020b and R2021a.
In my opinion this behavior cannot be explained by the documented limitations and should be considered a bug.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Prahlad Gowtham Katte el 15 de Feb. de 2022
Hello,
This is a known issue and has been communicated with the internal staff and it would be considered for a fix in the future.
##### 2 comentariosMostrar NingunoOcultar Ninguno
Scott Phillips el 21 de Mzo. de 2022
Has this bug been resolved yet? I'm getting similar errors
Walter Roberson el 21 de Mzo. de 2022
Still a problem in R2022a unfortunately.

Iniciar sesión para comentar.

### Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

R2021a

### Community Treasure Hunt

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

Start Hunting!

Translated by