function fanoplot(spikes, titles) % computes and plots fano factor as a function of window size % spikes: a cell array of vectors of spike times % titles: string that is used as a title for the plots windows = logspace(-3.0, -0.5, 100); mc = windows; vc = windows; ff = windows; for j = 1:length(windows) w = windows(j); counts = spikecounts(spikes, w); % statistics for current window: mc(j) = mean(counts); vc(j) = var(counts); ff(j) = vc(j)/mc(j); end subplot(1, 2, 1); scatter(mc, vc, 'filled'); title(titles); xlabel('Mean count'); ylabel('Count variance'); subplot(1, 2, 2); scatter(1000.0*windows, ff, 'filled'); title(titles); xlabel('Window [ms]'); ylabel('Fano factor'); xlim(1000.0*[windows(1) windows(end)]) ylim([0.0 1.1]); set(gca, 'XScale', 'log'); end