Borrar filtros
Borrar filtros

how do i find the matching data for locs when using findpeaks()

3 visualizaciones (últimos 30 días)
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
  2 comentarios
KSSV
KSSV el 5 de Feb. de 2020
What do you mean by plotting the pks and the other coloum in the data?
chengwei zhang
chengwei zhang el 5 de Feb. de 2020
in the CeramicRe.txt, there are two coloums of data, the one on the right side is the pks and the left side is time, but the code i used only return the pks with its position number in the data but i want to plot the pks vs. time

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 5 de Feb. de 2020
Editada: Adam Danz el 5 de Feb. de 2020
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, '*')

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by