Hi,

I'm using the findpeaks function to find the peaks of an array. After this, I should get the indices of the array corresponding to the width of the peak, both if calculated referring to the half-heigth or to the half-prominence of the peak.

Please, look at the attached images (taken from the findpeaks reference): in other words, I'm interested to find the indices corresponding to the horizontal yellow segments showed into the images.

Is there a way to do this? I'm looking for an existent function or method, but also any suggestion about the approach is welcome.

Finally, I'm also wondering about the possibility of extending this concept, i.e. to get the indices corresponding to a quote given as input, not only at 0.5*height or 0.5*prominence (as example, the width at 0.7*prominence, or at 0.3*height). Any suggestions?

Thank you so much for answering.

Kind regards.