Find index in 3D matrix for maximum value

12 ビュー (過去 30 日間)
Sharif Khalil
Sharif Khalil 2018 年 7 月 17 日
コメント済み: Sharif Khalil 2018 年 7 月 17 日
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

回答 (1 件)

OCDER
OCDER 2018 年 7 月 17 日
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 件のコメント
Sharif Khalil
Sharif Khalil 2018 年 7 月 17 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by