is there a way to obtain peak width after peak detection ?

조회 수: 35 (최근 30일)
LO
LO 2019년 5월 28일
댓글: Star Strider 2023년 6월 29일
I have used the function findpeaks to detect spikes in a signal
however I have initially used the halfprominence as width-reference
is there a way to obtain widths using half-height after such peak detection, having the peak timestamps and their amplitude values ?

채택된 답변

Star Strider
Star Strider 2019년 5월 28일
Not a stupid question at all.
You simply need to ask findpeaks to return them as outputs:
[pks,locs,widths,proms] = findpeaks(PeakSig,x);
See the documentation section on Peak Prominences (link) for an illustration and discussion. The ‘widths’ are defined as the full width at half of the maximum amplitude (FWHM).
  댓글 수: 2
LO
LO 2019년 5월 28일
thanks, I should have probably posted at the beginning the command I was using.
I know you get them as outputs. I was just wondering whether the width values (in heights) can be calculated from those values obtained using half prominence ([pks,locs,widths,proms])
or whether a new peak detection has to be made using half height.
I guess this now is the stupid question :)
Star Strider
Star Strider 2019년 5월 28일
I am not certain what you are asking.
The ‘height’ (and related ‘width’) and ‘prominence’ values are different, and only loosely related, at least as I read the documentation. The Prominence (link) property seems difficult to define. I would just use the FWHM value to characterise the peaks.
In other applications, I have used both ‘widths’ and ‘proms’ to select particular peaks, defining a desired peak by ‘(width > wv) & (prom > pv)’, where ‘wv’ and ‘pv’ were values determined elsewhere in the code. Perhaps you can combine them that way.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Adam Danz
Adam Danz 2019년 5월 28일
편집: Adam Danz 2019년 5월 28일
Use the "halfheight" width reference. There's an example here: https://www.mathworks.com/help/signal/ref/findpeaks.html#buhd6xj
[pks,locs,w,p] = findpeaks(PeakSig,x,'Annotate','extents','WidthReference','halfheight')
  댓글 수: 5
Carlos
Carlos 2023년 6월 29일
Thank you so much
Star Strider
Star Strider 2023년 6월 29일
My pleasure!

댓글을 달려면 로그인하십시오.


LO
LO 2019년 5월 28일
I know that, thanks.
what I wanted to know is whether one could get those values without doing the peak detection again
but I guess there is no way. stupid question most likely

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by