フィルターのクリア

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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by