MATLAB: Erlang distribution n=40 μ=8; 9; k=1; 10;

erlang distribution matlab plots

Hello, I'm new in matlab. I have task in my university to generate cdf and pdf plots of erlang distribution with parametes: n=40 μ=8; 9; k=1; 10;. Can someone help with this. Thanks in advance.

Best Answer

Using the definition of erlang pdf from Wikipedia https://en.wikipedia.org/wiki/Erlang_distribution, the following program can be written
mu = [8 9];
k = [1 10];
erlang_fun = @(x, mu, k) x.^(k-1).*exp(-x/mu)/(mu.^k.*factorial(k-1));
x = linspace(0, 300);
figure;
for i=1:numel(mu)
subplot(1,2,i)
plot(x, erlang_fun(x, mu(i), k(i)));
title(sprintf('\\mu=%d, k=%d', mu(i), k(i)));
end
Related Question