function fanoplot(spikes, titles) % Plots fano factor as a function of window size. % % Arguments: % 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 = zeros(1, length(windows)); vc = zeros(1, length(windows)); for j = 1:length(windows) w = windows(j); spikecounts = counts(spikes, w); mc(j) = mean(spikecounts); vc(j) = var(spikecounts); 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, vc ./ mc, '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