how to get x value of findpeaks

26 visualizaciones (últimos 30 días)
Alpay-Kaan Erbay
Alpay-Kaan Erbay el 18 de Mayo de 2022
Editada: Davide Masiello el 18 de Mayo de 2022
I use the following findpeaks method:
peaks = findpeaks(smoothed{i}, 'MinPeakHeight',0.5,...
'MinPeakDistance',200);
the peaks matrix for this contains the y values, but I would like to have the x values. How do I get these?

Respuestas (1)

Davide Masiello
Davide Masiello el 18 de Mayo de 2022
Editada: Davide Masiello el 18 de Mayo de 2022
If X is your array of x-values, do
[peaks,locs] = findpeaks(smoothed{i},'MinPeakHeight',0.5,'MinPeakDistance',200);
x_peaks = X(locs);
You can find more info at

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by