I am trying to model a poisson process. When I histogram the inter-event times, the distribution is exponential. I want to prove that the simulation is Poissonian. How can I calculate the Fano-factor?I have a list of waiting times and spiketimes.
2 次查看(过去 30 天)
显示 更早的评论
while duration <= Total_time
randNumbers = rand(1,1); IVI = -log(randNumbers)/rate;
SpikeTime = duration + IVI;
duration = duration + IVI; SpikeTimes = [SpikeTimes; SpikeTime];
counter = counter + 1;
IVI_hist(counter,1) = IVI;
end
figure(1) hist(IVI_hist, sqrt(length(IVI_hist)))
0 个评论
回答(1 个)
Aditya
2025-1-31
Hi Phil,
I understand that you are trying to calculate the fano factor .
The following script might help you doing the same :
% Assuming SpikeTimes is your list of spike times
Total_time = max(SpikeTimes); % Use the maximum spike time as total time
binWidth = 1; % Define the width of each bin (e.g., 1 second)
edges = 0:binWidth:Total_time; % Define the edges of the bins
% Calculate the number of spikes in each bin
spikeCounts = histcounts(SpikeTimes, edges);
% Calculate the mean and variance of spike counts
meanSpikeCounts = mean(spikeCounts);
varianceSpikeCounts = var(spikeCounts);
% Calculate the Fano factor
FanoFactor = varianceSpikeCounts / meanSpikeCounts;
% Display the Fano factor
fprintf('Fano Factor: %.2f\n', FanoFactor);
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!