chi-squared distribution
close all; clear all;
x = 0:0.2:100;
y = chi2pdf(x,38);
figure;
plot(x,y)
ylabel('Probability density');
xlabel('Chi-squared value');
% calculate chi-squared value over specific probability
% under specified degree of freedom
X_05 = chi2inv(0.95,38)
X_01 = chi2inv(0.99,38)
X_001 = chi2inv(0.999,38)
show = ['Chi-squared 0.05: ', num2str(X_05)];
text(60, 0.03, show);
show = ['Chi-squared 0.01: ', num2str(X_01)];
text(60, 0.025, show);
show = ['Chi-squared 0.001: ', num2str(X_001)];
text(60, 0.020, show);
title('Chi-squared distribution dof=38')