How to calculate FWHM from gaussian histogram fit?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Somnath Kale
am 17 Aug. 2022
Kommentiert: Star Strider
am 17 Aug. 2022
Hello
I was just trying to get the FWHM value for my histrogram with 8 bins for X = [0.6268 0.5372 0.5382 0.4272 0.4635 0.5422 0.5869 0.5308 0.5188 0.4759 0.6365 0.5532 0.5753 0.5734 0.5734 0.5465];
It will be really heplfull if someone guided with small portion of code to fit the gauassian distribution line and related mean, variance and fwhm.
thanks in advance!!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 17 Aug. 2022
Thje easiest way is to use histfit and then findpeaks with the name-value pair appropriate arguments —
X = [0.6268 0.5372 0.5382 0.4272 0.4635 0.5422 0.5869 0.5308 0.5188 0.4759 0.6365 0.5532 0.5753 0.5734 0.5734 0.5465];
figure
h = histfit(X)
line_x = h(2).XData;
line_y = h(2).YData;
[pk,loc,w] = findpeaks(line_y, 'WidthReference','halfheight')
FWHM = w
x_peak = line_x(loc)
pd = fitdist(X(:),'Normal')
To get the parameters of the distribution, use the fitdist function. (This is the function histfit uses.)
.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!