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
2018 年 12 月 14 日
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.
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.
カテゴリ
ヘルプ センター および File Exchange で Univariate Discrete Distributions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!