How can I generate reciprocal of a matrix

조회 수: 105 (최근 30일)
will99
will99 2019년 4월 19일
댓글: Walter Roberson 2020년 9월 15일
I have big matrix A 500 by 500 and I want to generate reciprocal of matrix A
what caluclation shuould I do or is there a function in matlab that I can use
%Matrix A
A = [2, 3, -1, 5; -1, 4, -7, -3; -6, 0, 3, 9; 7, 6, -3, 8];
%Matrix X, reciprocal of matrix A
X= ....

채택된 답변

Star Strider
Star Strider 2019년 4월 19일
It depends on what you mean by ‘reciprocal’. If you want ‘X’ such that:
A*X = eye(size(A,1))
then:
X1 = inv(A); % Inverse
X2 = pinv(A); % Pseudo-Inverse
will do what you want.
There are many precautions about calculating the inverse that you will likely encounter. A much better option would be to use the mldivide,\ (link) function if you want to solve linear systems, for example.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2019년 4월 19일
I suspect that you want inv(A) but possibly you want 1./A
In most cases inv() is better avoided in favor of using the \ operator or decomposition
  댓글 수: 2
S Prudhvi
S Prudhvi 2020년 9월 15일
Yes I want every element reciprocal in the matrix
Walter Roberson
Walter Roberson 2020년 9월 15일
1./A is element-by-element reciprocal.

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

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by