MATLAB: How can i find this minima

peaks minima find matlab

Hi everyone!
I have a question regarding finding peaks. I already used the "peakfinder"- function by Nathanael Yoder to find the 5 peaks (maximum), but I also have to find the marked values (minima). By doing it with his function I do not get them properly
. Does someone have an idea how to solve it? Many thanks in advance!

Best Answer

One approach is to use diff or gradient to calculate the approximate derivative of your data. Then ‘threshold’ the negative values of the derivative to be as large as necessary to detect the abrupt negative changes. Those will give you the points where the change is greatest. Calculating the points with the red arrows should be relatively straightforward.
The easiest way to find those using findpeaks is probably to first negate your signal (so the ‘dips’ become peaks), then use findpeaks to find the ‘peaks’ of the negated signal. Subtract as many indices as you need from those returned by findpeaks to get the points indicated by the arrows.