I am trying to find the local maxima of a number vector using MATLAB. The built-in findpeaks function will work for a vector, for example:
[0 1 2 3 2 1 1 2 3 2 1 0]
where the peaks (each of 3 's) occupy only one position in the vector, but if I have a vector:
[0 1 2 3 3 2 1 1 2 3 2 1 0]
the first "peak" takes two positions in the vector, and the findpeaks function findpeaks not pick it.
Is there a good way to write a maximization function that detects such peaks?
source share