필터 지우기
필터 지우기

taking the inverse of multiple matrix's

조회 수: 2 (최근 30일)
Andrew MacPhee
Andrew MacPhee 2023년 2월 9일
답변: Harshvardhan 2023년 3월 11일
sigma is a 28x28x10 matrix, or 10 28x28 matrix's. I'd like to get the iverse of each of those matrix's and store them in mean_inverse, but it is saying "Warning: Matrix is singular to working precision. " What am I doing wrong?
  댓글 수: 1
Paul
Paul 2023년 2월 9일
Not that it will address this issue, but you may be interested in pageinv

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

답변 (2개)

Torsten
Torsten 2023년 2월 9일
이동: Torsten 2023년 2월 9일
What am I doing wrong?
Nothing. But some or all of the sigma matrices that you try to invert seem to be singular.
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 2월 9일
There are, however, arguments to be made that in practice using inv() is most often a mistake, that there are very often mathematically better methods that do not involve explicit calculation of the inverse of a matrix.

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


Harshvardhan
Harshvardhan 2023년 3월 11일
% Define the matrices
A = [1 2; 3 4];
B = [5 6; 7 8];
C = [9 10; 11 12];
% Create a cell array of the matrices
matrices = {A, B, C};
% Loop through the matrices and calculate their inverses
for i = 1:length(matrices)
inv_matrices{i} = inv(matrices{i});
end
% Display the inverse matrices
for i = 1:length(inv_matrices)
disp(['Inverse of matrix ', num2str(i), ':']);
disp(inv_matrices{i});
end
Inverse of matrix 1:
-2.0000 1.0000 1.5000 -0.5000
Inverse of matrix 2:
-4.0000 3.0000 3.5000 -2.5000
Inverse of matrix 3:
-6.0000 5.0000 5.5000 -4.5000

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by