%dispois_n.m
%istogramma della poissoniana (dipendenza dal numero di successi)
figure(2);
clear;
nmax=30;
x=[0:1:nmax];
t=2;
    subplot(2,2,1);
    for k=0:nmax
        y(k+1)=poisson(k,t);
    end
    ymax=max(y);
    bar(x,y);
    axis([-1 nmax+1 0 1.2*ymax]);
    [string,errmsg] = sprintf('%-2d',t);
    string1=['\lambdat=',string];
    text(nmax-8,ymax,string1);
    xlabel('n');
    t=2*t;
    
    subplot(2,2,2);
    for k=0:nmax
        y(k+1)=poisson(k,t);
    end
    ymax=max(y);
    bar(x,y);
    axis([-1 nmax+1 0 1.2*ymax]);
    [string,errmsg] = sprintf('%-2d',t);
    string1=['\lambdat=',string];
    text(nmax-8,ymax,string1);
    xlabel('n');
    t=2*t;
    
    subplot(2,2,3);
    for k=0:nmax
        y(k+1)=poisson(k,t);
    end
    ymax=max(y);
    bar(x,y);
    axis([-1 nmax+1 0 1.2*ymax]);
    [string,errmsg] = sprintf('%-2d',t);
    string1=['\lambdat=',string];
    text(nmax-8,ymax,string1);
    xlabel('n');
    t=2*t;
    
    subplot(2,2,4);
    for k=0:nmax
        y(k+1)=poisson(k,t);
    end
    ymax=max(y);
    bar(x,y);
    axis([-1 nmax+1 0 1.2*ymax]);
    [string,errmsg] = sprintf('%-2d',t);
    string1=['\lambdat=',string];
    text(nmax-8,ymax,string1);
    xlabel('n');


