INTERSPIKEINTERVAL-CalculateinterspikeintervaldistributionforspiketrainISI=INTERSPIKEINTERVAL(SPIKETIMES,BINS)CalculatesthedistributionofinterspikeintervalsforthelistofspikesSPIKETIMES.SPIKETIMESshouldbeinthesametimeunitsasBINS.IfthefunctioniscalledwithoutaBINSargument:ISI=INTERSPIKEINTERVAL(SPIKETIMES)thenBINSistakentobe[0:0.001:0.100](thatis,1msbinsfrom0to0.100seconds)Example:% Poisson spike train at 3Hzdt=0.001;t=0:dt:100;rate=3;spikebins=rand(size(t))<rate*dt;% 0's and 1'sspikebin_indexes=find(spikebins);% find locations of spikesspiketimes=t(spikebin_indexes);% get the corresponding time valuesbins=0:0.001:0.1;ISI=interspikeinterval(spiketimes,bins);% plot as a fraction of totalbar(bins+0.001/2,ISI/sum(ISI));