function binomial03fig1
% Fig. B.6 Book Illustration for Binomial distribution (3/2007):
%     with 3 \pi_1 parameter values.
% pv(f_1) = p(f1,N-f1;\pi_1,1-\pi_1)
%         = Bi(N,f_1)*\pi_1^{f_1}*(1-\pi_1)^{N-f_1}
clc % clear variables, but must come before globals, 
%     else clears globals too.
clf % clear figures
fprintf('\nfunction binomialfig03 OutPut:');
pi1v =[0.25,0.5,0.75]; npi1 = 3;
N = 10; f1v = 0:N; nfact = factorial(N);
pv = zeros(N+1,npi1);
for ipi = 1:npi1
    pi1 = pi1v(ipi);
    pv(1,ipi) = (1-pi1)^N; 
    for f1 = 1:N
        pv(f1+1,ipi) = nfact/(factorial(f1)*factorial(N-f1))...
            *pi1^f1*(1-pi1)^(N-f1);
    end
end
kfig = 1; figure(kfig);
scrsize = get(0,'ScreenSize');
ss = [3.0,2.8,2.6,2.4,2.2,2.0];
plot(f1v,pv(:,1),'ko--',f1v,pv(:,2),'k^:',f1v,pv(:,3),'ks-.'...
    ,'MarkerSize',10,'MarkerFaceColor','k','LineWidth',2)
title(...
    'Binomial Distributions: p_1(f_1) = p(f_1,N-f_1;\pi_1,1-\pi_1)'...
        ,'Fontsize',44,'FontWeight','Bold');
ylabel('p_1(f_1)'...
        ,'Fontsize',44,'FontWeight','Bold');
xlabel('f_1, Binomial Frequency'...
        ,'Fontsize',44,'FontWeight','Bold');
hlegend=legend('\pi_1 = 0.25','\pi_1 = 0.50','\pi_1 = 0.75'...
    ,'Location','NorthEast');
set(hlegend,'Fontsize',36,'FontWeight','Bold');
set(gca,'Fontsize',36,'FontWeight','Bold','linewidth',3);
set(gcf,'Color','White','Position'...
    ,[scrsize(3)/ss(kfig) 70 scrsize(3)*0.60 scrsize(4)*0.80]);
% End binomial03fig1