chi2pdf
Chi-squared probability density function (PDF).
For each element of x, compute the probability density function (PDF) of the chi-squared distribution with df degrees of freedom. The size of y is the common size of x and df. A scalar input functions as a constant matrix of the same size as the other inputs.
Further information about the chi-squared distribution can be found at https://en.wikipedia.org/wiki/Chi-squared_distribution
See also: chi2cdf, chi2pdf, chi2rnd, chi2stat
Source Code: chi2pdf
## Plot various PDFs from the chi-squared distribution
x = 0:0.01:8;
y1 = chi2pdf (x, 1);
y2 = chi2pdf (x, 2);
y3 = chi2pdf (x, 3);
y4 = chi2pdf (x, 4);
y5 = chi2pdf (x, 6);
y6 = chi2pdf (x, 9);
plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", ...
x, y4, "-c", x, y5, "-m", x, y6, "-y")
grid on
xlim ([0, 8])
ylim ([0, 0.5])
legend ({"df = 1", "df = 2", "df = 3", ...
"df = 4", "df = 6", "df = 9"}, "location", "northeast")
title ("Chi-squared PDF")
xlabel ("values in x")
ylabel ("density")
|