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

2 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Prahlad Gowtham Katte
Prahlad Gowtham Katte am 15 Feb. 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 Kommentare
Scott Phillips
Scott Phillips am 21 Mär. 2022
Has this bug been resolved yet? I'm getting similar errors
Walter Roberson
Walter Roberson am 21 Mär. 2022
Still a problem in R2022a unfortunately.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by