w = 0.1;
bins = 0:1:10;

spikecounts{1} = counts(poissonspikes, w);
spikecounts{2} = counts(pifouspikes, w);
spikecounts{3} = counts(lifadaptspikes, w);
titles = {'Poisson', 'PIF OU', 'LIF adapt'};
for k = 1:3
    subplot(1, 3, k);
    [h, b] = hist(spikecounts{k}, bins);
    bar(b, h/sum(h));
    mu = mean(spikecounts{k});
    ppois = poisspdf(bins, mu);
    hold on;
    scatter(bins, ppois, 'filled');
    hold off;
    title(titles{k})
    xlabel('Spike count');
    xlim([-0.5, 8.5]);
    ylim([0.0 0.8]);
end
savefigpdf(gcf, 'spikecountshists.pdf', 20, 7);