MATLAB: How do i find the matching data for locs when using findpeaks()

findpeaks

Hi
I am using the function
[pks,locs]=findpeaks()
and the locs returns the position of that pks in the data when plotting
but what I want is plotting the pks and the other coloum in the data not the locs as the x-axis
thanks in advance

Best Answer

If your peaks plot is produced by
plot(time, data)
and you're locating the peaks with
[pks,locs]=findpeaks(data);
Then, to plot the peaks as a function of time,
plot(time(locs), pks, '*')
Related Question