28 lines
600 B
Matlab
28 lines
600 B
Matlab
rate = 100.0;
|
|
trials = 50;
|
|
tmax = 100.0;
|
|
|
|
% generate spikes:
|
|
spikes = poissonspikes( trials, rate, tmax );
|
|
% interspike intervals:
|
|
isivec = isis( spikes );
|
|
% histogram
|
|
f = figure( 1 );
|
|
isihist( isivec );
|
|
hold on
|
|
% theoretical density:
|
|
xmax = 5.0/rate;
|
|
x = 0:0.0001:xmax;
|
|
y = rate*exp(-rate*x);
|
|
plot( 1000.0*x, y, 'r', 'LineWidth', 3 );
|
|
% plot details:
|
|
title( sprintf( 'Poisson spike trains, rate=%g Hz, nisi=%d', rate, length( isivec ) ) )
|
|
xlim( [ 0.0 1000.0*xmax ] )
|
|
ylim( [ 0.0 1.1*rate ] )
|
|
legend( 'data', 'poisson' )
|
|
hold off
|
|
|
|
% serial correlations:
|
|
f = figure( 2 );
|
|
isiserialcorr( isivec, 10 );
|