Finding multiple x-intercepts for a dataset

I have a 2-D dataset that crosses the x-axis multiple times.
I would like help making a function that will return all the x values at which y = 0.
Any help for a day 1 newbie would be much appreciated!
Possibly helpful background: I'm analyzing sound spectra. I would like to find the peaks of the signal by finding where the 1st derivative crosses the x-axis.

 Respuesta aceptada

William Rose
William Rose el 28 de Jun. de 2021

1 voto

Matlab has a very nice peak finding function, findpeaks(), help here: It has nice options, including threshold, minimum peak prominence, minimum horizontal (i.e. time or frequency, in your case) separation, etc.

3 comentarios

William Rose
William Rose el 28 de Jun. de 2021
findpeaks() returns the peak amplitudes and the peak locations (i.e. frequencies, if analyzing a spectrum).
Jacob Hohsfield
Jacob Hohsfield el 28 de Jun. de 2021
I think this is what I need. Thank you!
William Rose
William Rose el 28 de Jun. de 2021
@Jacob Hohsfield, you;re welcome, and good luck on your work.

Iniciar sesión para comentar.

Más respuestas (1)

William Rose
William Rose el 28 de Jun. de 2021

1 voto

You said you have a 2D dataset. If you mean the spectrogram, the time dependent Fourier transform, then findpeaks() is not the right answer since it is for 1D signals.

Productos

Versión

R2021a

Etiquetas

Preguntada:

el 28 de Jun. de 2021

Comentada:

el 28 de Jun. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by