function bindemo
x=0:6;
n=5;
bar(x,  binopdf(x,n,1/n),'r' )
title('Poisson Approximation to Binomial Distributions')
xlabel('x')
ylabel('Probability of x ')
gtext(['red. Bin, n= ' num2str(n) ' p= ' num2str(1/n)])

hold on
n=2*n;
bar(x, binopdf(x,n,1/n),'g')
gtext(['green. Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
n=2*n;
bar(x, binopdf(x,n,1/n),'b')
gtext(['blue. Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
n=2*n;
bar(x, binopdf(x,n,1/n),'y')
gtext(['yellow. Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
bar(x, poisspdf(x,1),'w')
gtext(['white. Poisson 1 '])
hold off
figure
n=5;
stairs(x,  binocdf(x,n,1/n) )
title('Cumulative Distribution Functions')
gtext([' Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
hold on
n=2*n;
stairs(x, binocdf(x,n,1/n))
gtext([' Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
n=2*n;
stairs(x, binocdf(x,n,1/n))
gtext([' Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
n=2*n;
stairs(x, binocdf(x,n,1/n))
gtext([' Bin, n= ' num2str(n) ' p= ' num2str(1/n)])
stairs(x, poisscdf(x,1))
gtext([' Poisson 1 '])
hold off


