Borrar filtros
Borrar filtros

can i do inverse for array in matlab using for ? how ?

1 visualización (últimos 30 días)
3lewwi
3lewwi el 18 de Oct. de 2022
Comentada: Walter Roberson el 18 de Oct. de 2022
x=[1 2 3; 4 5 6; 7 8 9]

Respuestas (1)

David Hill
David Hill el 18 de Oct. de 2022
If det(x) ~=0, then matrix is invertable.Your matrix above is not.
x=[1 2 3; 4 5 6; 7 8 -1];
det(x)
ans = 30.0000
r=rref([x,eye(size(x))]);
Xinv=r(1:3,4:6)
Xinv = 3×3
-1.7667 0.8667 -0.1000 1.5333 -0.7333 0.2000 -0.1000 0.2000 -0.1000
x*Xinv
ans = 3×3
1.0000 0.0000 0 0.0000 1.0000 -0.0000 0.0000 0.0000 1.0000
Xinv*x
ans = 3×3
1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0 0 1.0000
  2 comentarios
John D'Errico
John D'Errico el 18 de Oct. de 2022
Note that using det to detemine if a matrix singular is just a bad idea. Use tools like rank, or cond instead.
3lewwi
3lewwi el 18 de Oct. de 2022
thx bro, but i want it by use ( for )

Iniciar sesión para comentar.

Categorías

Más información sobre Sparse Matrices en Help Center y File Exchange.

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by