Taking the Inverse of 6x6 Symbolic Real Symmetric Matrix Crashes MATLAB

6 Ansichten (letzte 30 Tage)
I am trying to compute the inverse of a 6x6 symbolic real-symmetric matrix, M, but everytime I run inv(M), MATLAB becomes unresponsive.
Does anyone have any suggestions for computing the inverse of a 6x6 symbolic real-symmetric matrix?
Each element of the matrix is a very long expression involving cos(...) and sin(...) of symbolic variables. Are there any algorithms or round-about ways of exploiting the real-symmetric properties of the matrix to compute its inverse that might involve fewer symbolic computations, thereby reducing the chance of causing MATLAB to hang?
I have tried eig(M), but that doesn't seem to work either. I have also tried expanding the Java heap size under "Preferences", but that doesn't seem to have had any observable effects.
  4 Kommentare
Zach Bortoff
Zach Bortoff am 10 Jun. 2022
That's probably true... The symbolic expression would probably become impractical.
But I'm trying to compute the projection matrix (as discussed here, http://hades.mech.northwestern.edu/images/7/7f/MR.pdf#page=320) of a robotic system that I am trying to model, which possesses several holonomic constraints.
My thinking is that if I can compute the projection matrix and multiply it by the mass, coriolis, and gravity matrices of the system, then the system would be more amenable to controller design. Ultimately, I would linearize the system and substitute in the system parameters, so I'm hoping that most of the nastiness will go away.
Zach Bortoff
Zach Bortoff am 10 Jun. 2022
@Bjorn Gustavsson That's exactly what I would like to do, but I don't know how I would exactly factorize the matrix in that way.
If it helps any, the matrix is itself the product of two matrices:
, where is a 9x9 block diagonal matrix consisting of 3 3x3 blocks, and A is a 6x9 matrix with no clear structure.
I can't post the output those matrices here, because there are too many characters in the comment, but the attached file will compute the dynamics in ~50-60 seconds. All the commented out part at the bottom is the stuff that hangs.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Jun. 2022
create a framework matrix to take the inverse of, and then subs()
syms M [6 6]
iM = inv(M) ;
imat = subs(iM, M, YourMatrix);
With the trig terms it would likely be tempting to simplify(imat) but that is likely to take a long time.
The results you get back will be correct (assuming the matrix is not singular). However, chances are high that the results will be useless for all practical purposes. You would have a matrix of huge expressions; then what? What will halving the analytic inverse do for you? If someone were to give you the thousands-of-terms result, except that they miscopied one sign, then how would you ever even notice? If you get back a megabyte of answer, what will you do with it?
  2 Kommentare
Zach Bortoff
Zach Bortoff am 10 Jun. 2022
Thanks. I was able to get a result, but yeah the expression is crazy.
Perhaps computing the inverse of the matrix isn't the best path forward for this project for the reasons you mention, but I'm trying it out.
My plan was to use this matrix to eliminate a term from the dynamics of a robot I am trying to model and design a controller for. Ultimately, I would have substituted in the system parameters and linearized the system about an equilibrium after a few more matrix manipulations, so I didn't really expect the end product to be super complex. But I'm not sure if that's even possible now given the complexity of the expressions. Still glad I tried it though.
Walter Roberson
Walter Roberson am 12 Jun. 2022
Kinematics are notorious for fragile, for being numerically unstable.
When I glanced at the paper, it looked as if they were placing constraints and solving within those constraints, in areas that are numerically well behaved. But... when you switch over to the symbolic equations, the symbolic equations do not encode the constraints, and the expressions that result will not necessarily be stable. For example the general form might have an (x-1)/(x-1) when x might pass through 1, with the paper perhaps demonstrating that it is not a problem under the rest of the conditions, but the Symbolic Toolbox going ahead and producing 0/0 in that term and failing over...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by