fitdist() how to return sigma value?

조회 수: 9 (최근 30일)
Lena
Lena 2014년 6월 23일
댓글: Star Strider 2014년 6월 24일
I want to be able to calculate the FWHM for purposes of energy and timing resolution in my data fitting... how do I pull the sigma value from the pdf that is returned using fitdist()?
h=hist(timingdat,100);
hist(timingdat,100)
xlabel('\Deltat (ns)');
ylabel('Counts');
grid();
histfit(timingdat,100);
pd=fitdist(timingdat(:),'normal')
x=0:0.01:200;
PDF=pdf(pd,x); %PDF is a vector of y values: it's our fit
PDF=PDF/max(PDF); %nor
y=max(h)-10;
PDF=PDF*y;
FWHM = sigma*2*(2*log(2))^(1/2)
hold on
str2=sprintf('%d counts, FWHM = ',countspeak2,FWHM);
title(str2)

채택된 답변

Star Strider
Star Strider 2014년 6월 24일
If you ask it nicely it is more than happy to tell you:
timingdat = 10 + 5*randn(25,1); % Create Data
pd=fitdist(timingdat(:),'normal')
sigma = pd.sigma
produces:
sigma =
4.7014e+000
  댓글 수: 2
Lena
Lena 2014년 6월 24일
Excellent! Thank you.
Star Strider
Star Strider 2014년 6월 24일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by