how to find the inverse of a 2x2xm matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Antworten (2)
Andrei Bobrov
am 2 Aug. 2013
Bearbeitet: Andrei Bobrov
am 2 Aug. 2013
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 Kommentare
Jan
am 2 Aug. 2013
@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
am 2 Aug. 2013
a=rand(2); % example matrix
b=inv(a) % inverse matrix
3 Kommentare
David Sanchez
am 2 Aug. 2013
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
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!