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

답변 (1개)

David Hill
David Hill 2022년 10월 18일
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

Note that using det to detemine if a matrix singular is just a bad idea. Use tools like rank, or cond instead.
thx bro, but i want it by use ( for )

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

릴리스

R2015a

질문:

2022년 10월 18일

댓글:

2022년 10월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by