is there a way to obtain peak width after peak detection ?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 ?
0 Commenti
Risposta accettata
Star Strider
il 28 Mag 2019
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 Commenti
Star Strider
il 28 Mag 2019
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.
Più risposte (2)
Adam Danz
il 28 Mag 2019
Modificato: Adam Danz
il 28 Mag 2019
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')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/221514/image.png)
5 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!