필터 지우기
필터 지우기

Locating global max in 3D plot

조회 수: 3 (최근 30일)
John Paul
John Paul 2021년 1월 22일
댓글: Star Strider 2021년 1월 23일
I'm working on some MATLAB code but I have encountered a problem that has hindered my progress.
Kindly would you assist me on how I may locate a global maxima value in a case where I have more than one maximas in a 3D plot.
I'm using this
Idx = find((Pmusic(:) == max(max(Pmusic(:)))));
[PmusicmaxRow,PmusicmaxCol] = ind2sub(size(Pmusic), Idx);
but it brings all the maximas but I am only interested with the indices of the global maxima.

채택된 답변

Star Strider
Star Strider 2021년 1월 22일
Try this:
[maxval,Idx] = max(Pmusic(:));
[PmusicmaxRow,PmusicmaxCol] = ind2sub(size(Pmusic), Idx);
I obviously cannot test this with your matrix, however it worked correctrly when I tested it with my test matrix.
  댓글 수: 4
John Paul
John Paul 2021년 1월 23일
Respected Sir, You are absolutely correct. This section of the code is supposed to genereate indices for the global maximas for 10 iterations and that is the reason ‘aaa’ and ‘ccc’ are (1x10) vectors. Thank you so much for your invalauble advice. You have made me move a step further with my work.
Star Strider
Star Strider 2021년 1월 23일
As always, my pleasure!
I am always happy to help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Direction of Arrival Estimation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by