%disbin.m
%distribuzione binomiale
figure(1);
clear;
n=6;
x=[0:1:n];
subplot(1,2,1);
p=0.3;
for i=0:n
    pb(i+1)=binom(i,n,p);
end
bar(x,pb)
axis([-1 7 0 0.35])
xlabel('n')
text(4.5,0.3,'a) p=0.3')

subplot(1,2,2);
p=0.5;
for i=0:n
    pb(i+1)=binom(i,n,p);
end
bar(x,pb)
axis([-1 7 0 0.35])
xlabel('n')
text(4.5,0.3,'b) p=0.5')