How can I find the value of vector for the local maximum and the

Illustration
Emmett - 2021-03-03T09:57:46+00:00
Question: How can I find the value of vector for the local maximum and the

How can I find the value of vector for the local maximum and the nearest local minima (befor and after maximum value)? I have a vector  array (e.g. 2 12 4 6 9 4 2 5 10 19 7 5 3 7 4) and I need to define the part of the vector with local maximum value and the neighbouring minima, located to the left and right of the maximum). In the above example it should be [2 5 10 19 7 5 3].how can I code that in matlab? any help please..

Expert Answer

Profile picture of Kshitij Singh Kshitij Singh answered . 2025-11-20

Why does the 12 at element 2 not qualify as a local max? Do you have the Image Processing Toolbox, try imregionalmax(). If you have the Signal Processing Toolbox, try findpeaks on the signal and the inverted signal.


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!