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

3 次查看(过去 30 天)
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.

采纳的回答

Prahlad Gowtham Katte
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by