Filter löschen
Filter löschen

Find index in 3D matrix for maximum value

3 Ansichten (letzte 30 Tage)
Sharif Khalil
Sharif Khalil am 17 Jul. 2018
Kommentiert: Sharif Khalil am 17 Jul. 2018
I have a 3D matrix 40X181X361, I want to find the index for the maximum value for each of the 40. Pp_loc gives me the 40 maximum values, I would like to find their indicies.
if true
% code
end
Xp = 10:50:2*Km;
Yp = 1*Km;
rho_p = sqrt(Xp.^2+Yp^2+HT^2);
FSPL_p = (4*pi*rho_p/lmda).^2; % Free Space Path Loss for Probe
Pp_dBm = zeros(length(Xp),length(thta),length(phi));
Pp_loc = zeros(1,length(Xp));
for pp = 1:length(Xp)
Pp_dBm(pp,:,:) = 30 + 10*log10((4*pi*abs(AF_Field_P).^2)/FSPL_p(pp));
Pp_loc(pp) = max(max(Pp_dBm(pp,:,:))); % Maximum Power at Probe
end

Antworten (1)

OCDER
OCDER am 17 Jul. 2018
Here's one example to find maximum value in a 3D matrix called A
A = randi(100, 3, 3, 50)
[x, y, z] = ind2sub(size(A), find(A == max(A(:))))
  1 Kommentar
Sharif Khalil
Sharif Khalil am 17 Jul. 2018
What I am looking for is for every value of x, the maximum value of the matrix y and z. which will give an answer looks like x =1; y = 80; z = 50; x = 2; y = 30; z = 100; and so on. Thanks

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by