function [asdr bins] = asdr(spktime,binsize,bound)

% ASDR find the array wide spike detection rate
% ASDR(spktime,binsize,bound,figtit) plots the ASDR for spike times
% provided by spktime. This is time histogram with bin size equal to
% binsize. Can localize data to a spectific time bound = [t1 t2]. Give the
% figure a title with figtit.

% check number and type of arguments
if nargin < 3
    bound = zeros(2,1);
    bound(1) = spktime(1);
    bound(2) = spktime(end);
end
if( nargin < 2)
    binsize = 1;
end
if( nargin < 1)
    error('first argument required');
end

bins = bound(1):binsize:bound(2);
asdr = hist(spktime,bins);

end