Inverse of a matrix in MATLAB and Python
조회 수: 6 (최근 30일)
이전 댓글 표시
Python code:
A= np.array([[1,2,3],[2,3,4],[3,4,5]])
print(np.linalg.inv(A))
MATLAB code:
A = [1,2,3;2,3,4;3,4,5]
inv(A)
Python Output:
[[-4.50359963e+15 9.00719925e+15 -4.50359963e+15]
[ 9.00719925e+15 -1.80143985e+16 9.00719925e+15]
[-4.50359963e+15 9.00719925e+15 -4.50359963e+15]]
Matlab Output:
ans =
1.0e+16 *
0.3002 -0.6005 0.3002
-0.6005 1.2010 -0.6005
0.3002 -0.6005 0.3002
댓글 수: 0
답변 (1개)
KSSV
2022년 11월 4일
You are to trying to fid the inverse of a singular matrix. A singular matrix is the one which doesn't have inverse. So different programming languages, different versions of the same languages might give different answers based on the math library they use.
참고 항목
카테고리
Help Center 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!