How to get the indices corresponding to the width of a peak?
14 ビュー (過去 30 日間)
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.
I do not know why these 0.5*height indices are important since they actually do not have any meaning. When the peaks are overwhelming 0.5*height can be practically anywhere for a given height. Especially if the vector contains noisy data. The correct way would be to fit peaks.
But if you want to find the half value, you can use the find function and look for the 0.5*height values in the vector. Then you can choose the closest or any of the found indices as you wish. Like:
where X is your vector (or part of your vector).if you want to find the left 0.5*height value then
for right indice=find(X(peakindice:end)<height/2,'first')
But if your vector is rather noisy it will not be a correct value anyway.
その他の回答 (0 件)
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!