How to find the local maxima/minima for 3D surf plot with the location of x and y coordinates?
48 views (last 30 days)
Show older comments
Daniyar Saparov
on 29 Jan 2018
Commented: Scout Patel
on 15 Aug 2022
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!
1 Comment
Scout Patel
on 15 Aug 2022
If you don't have the Image Processing Toolbox:
[TF1,P] = islocalmax(Array,2,'MinProminence',4);%threshold at 4...change accordingly
P(TF1)
V1 = find(TF1, 3, 'first') % this finds the first 3...change accordingly
[y1,x1]=ind2sub(size(Array),V1)
Accepted Answer
Arun Mathamkode
on 1 Feb 2018
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.
More Answers (0)
See Also
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!