How to inverse a matrix efficiently?

90 次查看(过去 30 天)
Hi All,
I have a 6x6 matrix with many symbolic variables inside.
I am looking to invert this matrix.
The matrix i have is the "stiffness matrix" in solid mechanics, and i'm looking to get the "compliance matrix" which is just the inverse.
I am not solving a linear set of equations, so the A\b trick doesnt work for me.
Is there a way to mimic the steps of the A\b inverse on a single matrix? I suspect no otherwise the command would already exist, but i may as well ask.
Any help would be greatly appreciated
Thanks!

采纳的回答

Mohammad Abouali
Mohammad Abouali 2014-9-28
编辑:Mohammad Abouali 2014-9-28
if you are not looking for symbolic solution to the matrix inversion, but you have the numerical values of the entries in the 6x6 matrix and you want to know the numerical values for the inverse of that try this:
Ainv= A\eye(6);
or
Ainv=inv(A);
This would give you the inverse of A numerically.
Try this code, it would give you the inverse of a 6x6 mtrix symbolically. (hence you need symbolic toolbox of MATLAB) (and don't try this on big matrices):
for i=1:6
for j=1:6
eval(['syms a' num2str(i) num2str(j) ' real']);
eval(['A(' num2str(i) ',' num2str(j) ')= a' num2str(i) num2str(j) ';']);
end
end
Ainv=inv(A)
The inverse would be an ugly looking matrix with lots of terms in it. Try to use simplify or something on terms to make it easier to read. Or sometimes I paste it in a text editor and manually simplify it myself. for example I go and using find and replace that exists in every editor I say for example replace every a11*a22-a12*a21 by T1 and so on.

更多回答(1 个)

Image Analyst
Image Analyst 2014-9-28
编辑:Image Analyst 2014-9-28
Have you tried the inv() function to compute the inverse of a matrix?

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by