How to plot Central/Non-central chi square pdf?

I have 1000 samples of energy. I want to plot central and non-central chi square pdf. I checked the Matlab documentation, I don't understand, how to calculate/choose values of degree of freedom and delta. Can anyone help?

回答 (1 件)

Jeff Miller
Jeff Miller 2018 年 12 月 14 日

1 投票

You need to estimate the distribution parameter(s) from your 1000 data values (call them x).
In principle you would use fitdist(x,'chisquare') or 'noncentralchisquare', but I don't think the matlab distribution-fitter recognizes either of these two distributions.
If you are willing to do some downloading, I think you can do what you want with Cupid .
The commands would look something like this:
mychi=ChiSq(10); % Make a chi-square distribution object
mychi.EstML(x) % Estimate its parameter based on your data
xvals = 0.1:.1:20; % Pick a range of x values over which you want to plot the distribution
pdfvals = mychi.PDF(xvals,); % Compute the pdf of the distribution at each x value
plot(xvals,pdfvals); % plot the distribution
mynoncenchi=ChiSqNoncentral(10,.2); % Same as above, but using a different distribution object.
mynoncenchi.EstML(x)
noncenpdfvals = mynoncenchi.PDF(xvals,);
plot(xvals,noncenpdfvals);
where x is your data, and 10 and .2 are your initial guesses for the distribution parameters.

タグ

質問済み:

2018 年 12 月 14 日

回答済み:

2018 年 12 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by