14 Detecting the two peaks of the claps
To find the exact location of the peaks in the upper envelope type the following into the Command Window:
findpeaks(yupper)
The findpeaks
function plots the input vector and indicates all of the local maxima in the vector using triangles.
findpeaks:
14.1 Getting the values and locations of the peaks
We need the exact locations of the peaks to determine if the claps are one-half second apart. To get the peak values and their indices type the following into the Command Window:
[pks, locs] = findpeaks(yupper)
pks
is the vector of local maxima values. locs
is the vector of indices for yupper
that correspond to the values in pks
; in other words pks
is equal to the vector:
yupper(locs)