subplot(121);

data = load('1hz.txt');

xlabel('Frequency bins');

ylabel('Number of events');

draw_hist_poisson;

title('Poisson ~1Hz data: Poisson and Gaussian fits');

grid on;

xlim([-0.5 4]);

hold on;

x = linspace(0,4);

mu = mean(data);

p = 100*1/sqrt(2*pi*mu)*exp(-(x-mu).^2/(2*mu));

plot(x,p,'LineWidth',2);



subplot(122);

data = load('4hz.txt');

xlabel('Frequency bins');

ylabel('Number of events');

draw_hist_poisson;

title('Poisson ~4Hz data: Poisson and Gaussian fits');

grid on;

xlim([-0.5 8]);

hold on;

x = linspace(0,8);

mu = mean(data);

p = 100*1/sqrt(2*pi*mu)*exp(-(x-mu).^2/(2*mu));

plot(x,p,'LineWidth',2);

