close all
colors = ['k', 'r', 'g', 'b', 'c', 'm', 'k'];
symbol = ['^', 'o', '*', 's', 'x', '+', 'd'];
figure
N = [20,30,40,50,100]
for nn = 1:length(N)
    n = N(nn);
m = 6;
p = linspace(.01,.5,m);
q = 1-p;
for k = 1:n
   nk = n-k+1:n;
   a(k) = prod(nk)/(factorial(k));
   a(k) = 1/beta(k+1,n-k+1); 
end
for k = 1:n
    b(k,1:m) = (1/n)*a(k).*p.^k.*q.^(n-k);
end
hold on
for i = 1:m
  plot(1:n,b(1:n,i),[colors(nn), '-']);
end
end
hold off