How to use findpeaks to find the width of the peak at 1/e^2.
Afficher commentaires plus anciens
I have a data and I want to find the peak value at 1/e^2. What I use is the following code.
x=field5(:,1);
y=field5(:,2);
e = exp(1)
[pks,locs,fwhm,proms] = findpeaks(y, x);
[~,i] = sort(pks,'descend');
peak_1 = pks(i);
esquared = max(peak_1)*1/e^2;
z = abs(y-esquared);
[p,loc] = findpeaks(-z);
plot(x,y,'b',x(loc),y(loc),'+r');
angle = diff(x(loc))/2
What I want to get is the width of the peak at the value of 1/e^2 (like FWHM but lower), but I get wrong results. The two points are not at the correct locations expecting them to be infront of each other. 


1 commentaire
dpb
le 26 Nov 2021
I use findpeaks only to locate the actual peak location(s) of interest and then interp1 to locate the intersection with the desired level if want precise intersection(*).
It would be a useful enhancement if the ' WidthReference' named parameter would take an absolute level or percentage of the peak height besides the two named references. I've always wondered why TMW didn't do that from the git-go.
(*) I know I had a utility function coded in prior occupation/when still had a day job, but I didn't seem to get it off the corporate machine along with a fair amount of other things I've occasionally missed since. But, it's not difficult to implement.
Réponse acceptée
Plus de 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!
