Plot prominences coming from findpeaks
Afficher commentaires plus anciens
Using this example, I can get a nice plot that contains the peaks and the prominences (and the widths too which I don't need):
findpeaks(X,'MinPeakProminence',0.05,'Annotate','extents')
However, I need the peaks and prominences plotted in a different plot that has different axes, other plots and better colors, so I plot them manually with a hold on as:
[pks,locs,~,p] = findpeaks(X,'MinPeakProminence',0.05,'Annotate','extents');
my_plot(X,time) %i have my own plotting function for this, which has a bunch of plot-beautifying stuff
hold on
scatter(time(locs),pks,20,'k','filled','v')
hold off
But I have no idea how to plot the prominences, since the prominence data p is a single number, I do not know where to start the line and where to finish it.
2 commentaires
dpb
le 13 Juil 2022
'Pends on what you want the plot to be -- the 'annotate' option draws the prominence as the vertical line from the associated peak less the prominence value. That's it. For each peak, the y vector is [pk(i), pk(i)-p(i)]
The other thing the builtin plotting function does is to draw the horizontal line at pk(i)-p(i)/2 -- that's the one that you have to interpolate the signal to find the crossing on the x axis to the left/right of the peak location.
Réponses (0)
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!