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/psth.m

15 lines
332 B
Matlab

function p = psth(spikes, dt, tmax)
% plots a PSTH of the spikes with binwidth dt
t = 0.0:dt:tmax+dt;
p = zeros(1, length(t));
for k=1:length(spikes)
times = spikes{k};
[h, b] = hist(times, t);
p = p + h;
end
p = p/length(spikes)/dt;
t(end) = [];
p(end) = [];
plot(t, p);
end