# Matrix Rank Error

I have a linear State Space model and was trying to tell if it was completely controllable. When I get the matrix with ControllabilityMatrix and then calculate the rank I get an incorrect matrix rank that indicates that the system is not completely controllable, but when I run the command with ControllableModelQ it returns True. Why is there discrepancies with the two?

A1 = {{0, 0, 0, Cos[\[Theta]], -Sin[\[Theta]], 0}, {0, 0, 0,
Sin[\[Theta]], Cos[\[Theta]], 0}, {0, 0, 0, 0, 0, 1}, {0,
0, -9.81*Cos[\[Theta]], -50/10, 0, 0}, {0, 0, 9.81*Sin[\[Theta]],
0, -5, 0}, {0, 0, 0, 0, 0, -100/0.1}} /. {\[Theta] -> Pi/2}

B = {{0, 0}, {0, 0}, {0, 0}, {1/10, 0}, {0, 0}, {0, 1/0.1}}

ssm = StateSpaceModel[{A1, B}, SamplingPeriod -> None,
SystemsModelLabels -> None]

MatrixRank[ControllabilityMatrix[ssm]]

ControllableModelQ[ssm]

• I don't know what controllable means but try MatrixRank[ControllabilityMatrix[ssm], Tolerance -> 0]. Dec 1, 2022 at 3:03
• Alternatively, if you use exact numbers throughout (i.e. replace -100/0.1 by -1000, replace 9.81 by 981/100, ...) then ControllabilityMatrix[ssm] has exact entries and MatrixRank returns $6$. Dec 1, 2022 at 16:22

ControllableModelQ can check this 3 different ways. If any one of them is True, it returns True.
AnyTrue[{"Matrix", "Gramian", "PBH"},