29 lines
1007 B
Matlab
29 lines
1007 B
Matlab
function plot_isi_hist(isis, binwidth)
|
|
% Plot and annotate histogram of interspike intervals.
|
|
%
|
|
% isihist(isis, binwidth)
|
|
%
|
|
% Arguments:
|
|
% isis: vector of interspike intervals in seconds
|
|
% binwidth: optional width in seconds to be used for the isi bins
|
|
|
|
if nargin < 2
|
|
[pdf, centers] = isi_hist(isis);
|
|
else
|
|
[pdf, centers] = isi_hist(isis, binwidth);
|
|
end
|
|
|
|
bar(1000.0*centers, nelements); % milliseconds on x-axis
|
|
xlabel('ISI [ms]')
|
|
ylabel('p(ISI) [1/s]')
|
|
% annotation:
|
|
misi = mean(isis);
|
|
sdisi = std(isis);
|
|
disi = sdisi^2.0/2.0/misi^3;
|
|
text(0.95, 0.8, sprintf('mean=%.1f ms', 1000.0*misi), 'Units', 'normalized', 'HorizontalAlignment', 'right')
|
|
text(0.95, 0.7, sprintf('std=%.1f ms', 1000.0*sdisi), 'Units', 'normalized', 'HorizontalAlignment', 'right')
|
|
text(0.95, 0.6, sprintf('CV=%.2f', sdisi/misi), 'Units', 'normalized', 'HorizontalAlignment', 'right')
|
|
%text(0.5, 0.3, sprintf('D=%.1f Hz', disi), 'Units', 'normalized')
|
|
end
|
|
|