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

% ASDR calculate array wide spike rate with various bin sizes and bounds

% check number and type of arguments
if nargin < 3 
    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);

plot(bins,asdr,'k-')
ylabel(strcat(['ASDR (spks/',num2str(binsize),' sec)']));
end