Taking the Inverse of 6x6 Symbolic Real Symmetric Matrix Crashes MATLAB
조회 수: 6 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2022년 6월 10일
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
Walter Roberson
2022년 6월 12일
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...
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!