fitdist() how to return sigma value?

7 views (last 30 days)
Lena
Lena on 23 Jun 2014
Commented: Star Strider on 24 Jun 2014
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)

Accepted Answer

Star Strider
Star Strider on 24 Jun 2014
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!