find peak in data
Mostrar comentarios más antiguos
hello i need to find peaks in this graph how can i do this

Respuestas (1)
Star Strider
el 18 de Dic. de 2021
0 votos
Use either the findpeaks or islocalmax funcitons. The islocalmax function returns a logical vector, so to get the numerical indices from it, use the find function.
.
2 comentarios
Lior Genfon
el 18 de Dic. de 2021
Star Strider
el 18 de Dic. de 2021
I do not have your data, so I cannot write code that applies specifically to it.
Both functions have appropraite name-value pair arguments to select only the highest (or lowest) peak in a particular region. For findpeaks it is 'MinPeakDistance', and for islocalmax and islocalmin it is 'MinSeparation'.
To get the negative peaks with findpeaks, negate the first argument, then negate again to get the actual values —
[pks,plocs] = findpeaks(y, ''MinPeakDistance',100) % Peaks
[vys,vlocs] = findpeaks(-y, ''MinPeakDistance',100) % Peaks
PeakVals = pks;
ValyVals = -vlys;
Use the correct values for 'MinPeakDistance'. The location index vectors retain their validity regardless.
.
Categorías
Más información sobre Descriptive Statistics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
