Locating global max in 3D plot
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Paul
el 22 de En. de 2021
Comentada: Star Strider
el 23 de En. de 2021
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.
0 comentarios
Respuesta aceptada
Star Strider
el 22 de En. de 2021
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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!