MATLAB: How to find the local maxima/minima for 3D surf plot with the location of x and y coordinates

3d plotslocal maxima

Hello. I have a 3D surf plot of an eigenvalue, that depends on both x and y. I wanted to find the values of the local minima/maxima near some specific coordinates, as well as the coordinates themselves at those points. Is it possible to do so? I used to do this in mathematica, but don't know how to do it in matlab. Thanks!

Best Answer

You can use the imregionalmax function from the Image Processing Toolbox. The following answer will be useful to you. https://www.mathworks.com/matlabcentral/answers/277512-how-to-find-peaks-in-3d-mesh
imregionalmax returns a matrix with ones at the coordinates where there is local maxima present and zeros at all other locations. If you want to find the local maxima near a coordinate, you can select a suitable neighborhood and search for ones in that region.
Related Question