필터 지우기
필터 지우기

how to find the inverse of a 2x2xm matrix?

조회 수: 3 (최근 30일)
padoh
padoh 2013년 8월 2일
i have extracted a 2x2xm matrix from an s2p file and i want to find its inverse. how do i go about doing this?
the question is like this:
a(:,:,1) =
-0.6044 - 0.1389i -5.2117 -32.3236i -0.0019 - 0.0205i -0.6058 - 0.1386i
a(:,:,2) =
-0.5319 - 0.1475i -4.6956 -34.9899i -0.0016 - 0.0213i -0.5335 - 0.1473i
a(:,:,3) =
-0.4557 - 0.1551i -4.1408 -37.3825i -0.0014 - 0.0220i -0.4574 - 0.1549i
this is a 3D matrix a.i want an inverse such that: inv (a(:,:,1)) inv (a(:,:,2)) inv (a(:,:,3)) and i want a single command that coulod do it or a code so that the answer is still in the form of a 3D matrix.

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2013년 8월 2일
편집: Andrei Bobrov 2013년 8월 2일
a(:,:,1) =[-0.6044-0.1389i, -5.2117-32.3236i;-0.0019-0.0205i, -0.6058-0.1386i]
a(:,:,2) =[-0.5319-0.1475i, -4.6956-34.9899i;-0.0016-0.0213i, -0.5335-0.1473i]
a(:,:,3) =[-0.4557-0.1551i, -4.1408-37.3825i;-0.0014-0.0220i, -0.4574-0.1549i]
s = size(a);
e1 = eye(s(1:2));
for jj = s(3):-1:1
b(:,:,jj) = a(:,:,jj)\e1;
end
  댓글 수: 2
padoh
padoh 2013년 8월 2일
ive entered the exact code in matlab n no output matrix b is generated and no error has occurred either
Jan
Jan 2013년 8월 2일
@padoh: Then use the debugger to step through the code line by line to find out, what's going own. It is a good idea to invest own effort when a problem is discussed in the forum. Do not wait for others to solve your problem.

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


David Sanchez
David Sanchez 2013년 8월 2일
a=rand(2); % example matrix
b=inv(a) % inverse matrix
  댓글 수: 3
padoh
padoh 2013년 8월 2일
the question is like this:
a(:,:,1) =
-0.6044 - 0.1389i -5.2117 -32.3236i
-0.0019 - 0.0205i -0.6058 - 0.1386i
a(:,:,2) =
-0.5319 - 0.1475i -4.6956 -34.9899i
-0.0016 - 0.0213i -0.5335 - 0.1473i
a(:,:,3) =
-0.4557 - 0.1551i -4.1408 -37.3825i
-0.0014 - 0.0220i -0.4574 - 0.1549i
this is a 3D matrix a.i want an inverse such that: inv (a(:,:,1)) inv (a(:,:,2)) inv (a(:,:,3)) and i want a single command that coulod do it or a code so that the answer is still in the form of a 3D matrix.
David Sanchez
David Sanchez 2013년 8월 2일
Maybe this is what you need:
A=rand(4,4,4);
B = zeros(size(A));
for k=1:size(A,3)
B(:,:,k) = inv(A(:,:,k));
end

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by