How to inverse a matrix efficiently?
97 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tyler
il 27 Set 2014
Commentato: Image Analyst
il 28 Set 2014
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!
0 Commenti
Risposta accettata
Mohammad Abouali
il 28 Set 2014
Modificato: Mohammad Abouali
il 28 Set 2014
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.
0 Commenti
Più risposte (1)
Image Analyst
il 28 Set 2014
Modificato: Image Analyst
il 28 Set 2014
Have you tried the inv() function to compute the inverse of a matrix?
1 Commento
Vedere anche
Categorie
Scopri di più su Function Creation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!