This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/pointprocesses/code/isiserialcorr.m
2014-11-12 18:39:02 +01:00

27 lines
647 B
Matlab

function isicorr = isiserialcorr( isis, maxlag )
% serial correlation of isis
% isis: vector of interspike intervals
% maxlag: the maximum lag
lags = 0:maxlag;
isicorr = zeros( size( lags ) );
for k = 1:length(lags)
lag = lags(k);
if length( isis ) > lag+10
cc = corrcoef( [ isis(1:end-lag)', isis(1+lag:end)' ] );
isicorr(k) = cc( 1, 2 );
end
end
if nargout == 0
% plot:
plot( lags, isicorr, '-b' );
hold on;
scatter( lags, isicorr, 100.0, 'b', 'filled' );
hold off;
xlabel( 'Lag k' )
ylabel( '\rho_k')
end
end