MATLAB Answers

how to find FWHM in histogram

19 views (last 30 days)
sani
sani on 28 May 2020
Answered: Image Analyst on 29 May 2020
how can I evaluate the FWHM in a histogram with 2 peaks or more? I couldn'f find a built-in function...
thanks!

  2 Comments

Rik
Rik on 28 May 2020
Since there isn't a builtin function, you will have to write one yourself.
I would suggest starting with finding the peak.
sani
sani on 28 May 2020
Thenks, yes it will make it much easier

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 29 May 2020
Try this (untested):
counts = histcounts(data);
maxCounts = max(counts);
leftBin = find(counts > maxCounts/2, 1, 'first')
rightBin = find(counts > maxCounts/2, 1, 'last')
fwhm = rightBin - leftBin; % Add 1 if you want, depending on how you define width.

  0 Comments

Sign in to comment.

More Answers (0)


Translated by