Borrar filtros
Borrar filtros

Find index in 3D matrix for maximum value

3 visualizaciones (últimos 30 días)
Sharif Khalil
Sharif Khalil el 17 de Jul. de 2018
Comentada: Sharif Khalil el 17 de Jul. de 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

Respuestas (1)

OCDER
OCDER el 17 de Jul. de 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 comentario
Sharif Khalil
Sharif Khalil el 17 de Jul. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by