gampdf
Gamma probability density function (PDF).
For each element of x, compute the probability density function (PDF) of the Gamma distribution with shape parameter k and scale parameter theta. The size of y is the common size of x, k and theta. A scalar input functions as a constant matrix of the same size as the other inputs.
There are two equivalent parameterizations in common use:
gampdf.
Further information about the Gamma distribution can be found at https://en.wikipedia.org/wiki/Gamma_distribution
See also: gamcdf, gaminv, gamrnd, gamfit, gamlike, gamstat
Source Code: gampdf
## Plot various PDFs from the Gamma distribution
x = 0:0.01:20;
y1 = gampdf (x, 1, 2);
y2 = gampdf (x, 2, 2);
y3 = gampdf (x, 3, 2);
y4 = gampdf (x, 5, 1);
y5 = gampdf (x, 9, 0.5);
y6 = gampdf (x, 7.5, 1);
y7 = gampdf (x, 0.5, 1);
plot (x, y1, "-r", x, y2, "-g", x, y3, "-y", x, y4, "-m", ...
x, y5, "-k", x, y6, "-b", x, y7, "-c")
grid on
ylim ([0,0.5])
legend ({"α = 1, θ = 2", "α = 2, θ = 2", "α = 3, θ = 2", ...
"α = 5, θ = 1", "α = 9, θ = 0.5", "α = 7.5, θ = 1", ...
"α = 0.5, θ = 1"}, "location", "northeast")
title ("Gamma PDF")
xlabel ("values in x")
ylabel ("density")
|