# Finding local minima for a signal

310 views (last 30 days)
neamah al-naffakh on 8 Aug 2016
I have used the (findpeaks) function in Matlab in order to find the locations and the value of the peaks ( Local Maxima ) in the signal.
please, Is there any function to extract the local minimums of the following graph?

Walter Roberson on 8 Aug 2016
If you have a routine that can find local maxima, then to find local minima, apply the local maxima routine to the negative of the data. Like
findpeaks(-X_Segments{nn},'MinPeakDistance', 20)
neamah al-naffakh on 8 Aug 2016
thank you so much mate
Med Aymane Ahajjam on 27 Jan 2019
Thanks!

Azzi Abdelmalek on 8 Aug 2016
Use
findpeaks(-your_signal)
neamah al-naffakh on 8 Aug 2016
thank you so much mate
Med Aymane Ahajjam on 27 Jan 2019
Thanks!

Image Analyst on 9 Aug 2016
You're probably okay with your data, but beware of findpeaks() if your max or min spikes have flat tops or bottoms. It will give only the first index. In that case you want to use the imregionalmin() function from the Image Processing Toolbox. Just look at this example with a min that has a flat bottom:
data = [ 1 3 4 2 2 2 4 4 5 6] % Flat bottom with value of 2 from indexex 4-6
[peakValues, indexesOfPeaks] = findpeaks(-data)
peakValues = -peakValues
minIndexes = imregionalmin(data)
data =
1 3 4 2 2 2 4 4 5 6
peakValues =
-2
indexesOfPeaks =
4
peakValues =
2
minIndexes =
1 0 0 1 1 1 0 0 0 0
neamah al-naffakh on 9 Aug 2016
hi mate, thanks for your effort i will check your solution and reply back , but do you mind have a look to this question please?
Image Analyst on 9 Aug 2016
I don't know how to answer that question.

shima tavakoli on 13 Feb 2018
my signal is asymmetric and its negative parts are different. how to deal with negative parts peaks then? cant negative the signal in this case!
Image Analyst on 13 Feb 2018
Who knows? You forgot to read this and forgot to attach your signal and a screenshot of it, so there's not much I can say, other than to write custom code to deal with it.