How to calculate FWHM from gaussian histogram fit?

14 ビュー (過去 30 日間)
Somnath Kale
Somnath Kale 2022 年 8 月 17 日
コメント済み: Star Strider 2022 年 8 月 17 日
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!!

採用された回答

Star Strider
Star Strider 2022 年 8 月 17 日
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)
h =
2×1 graphics array: Bar Line
line_x = h(2).XData;
line_y = h(2).YData;
[pk,loc,w] = findpeaks(line_y, 'WidthReference','halfheight')
pk = 6.9351
loc = 51
w = 38.8687
FWHM = w
FWHM = 38.8687
x_peak = line_x(loc)
x_peak = 0.5458
pd = fitdist(X(:),'Normal')
pd =
NormalDistribution Normal distribution mu = 0.544113 [0.514699, 0.573526] sigma = 0.0551991 [0.0407758, 0.0854312]
To get the parameters of the distribution, use the fitdist function. (This is the function histfit uses.)
.
  4 件のコメント
Somnath Kale
Somnath Kale 2022 年 8 月 17 日
Yupp!
Thank you very much for your time efforts and suggestions!
looking fourword to your kind help in future as well!!
Star Strider
Star Strider 2022 年 8 月 17 日
As always, my pleasure!
I will help as much I am able!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by