15 lines
332 B
Matlab
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
|