How to find the time of the max peak in a signal?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jan Ali
el 23 de Mayo de 2021
Comentada: Star Strider
el 23 de Mayo de 2021
I have a signal data (x) which is 2s long. There is a peack on the signal that I can find with the findpeaks(x) function.
I am wondering how to find the conrresponding time?
Thanks in advance,
0 comentarios
Respuesta aceptada
Star Strider
el 23 de Mayo de 2021
The easiest way is to have findpeaks return the indices in the second output —
t = ...; % Time Vector
s = ...; % Signal Vector
[pks,locs] = findpeaks(y);
peak_time = t(locs)
.
2 comentarios
Star Strider
el 23 de Mayo de 2021
The findpeaks fucntion only operates on vectors, so it will be necessary to iterate through individual rows or columns (since I cannot determine that from what you wrote).
Also, it will be necessary to use the abs function to take calculate the magnitude of the complex elements that you input to findpeaks.
From the documentation for the input data:
Input data, specified as a vector. data must be real and must have at least three elements.
.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!