[pointprocesses] fixed exercises

This commit is contained in:
Jan Benda 2021-01-18 19:09:56 +01:00
parent 6a643cd347
commit 753d756409
5 changed files with 3 additions and 12 deletions

View File

@ -6,16 +6,12 @@ function rasterplot(spikes, tmax)
% Arguments:
% spikes: a cell array of vectors of spike times in seconds
% tmax: plot spike raster up to tmax seconds
in_msecs = tmax < 1.5
spiketimes = [];
trials = [];
ntrials = length(spikes);
for k = 1:ntrials
times = spikes{k};
times = times(times<tmax);
if in_msecs
times = 1000.0*times; % conversion to ms
end
% (x,y) pairs for start and stop of stroke
% plus nan separating strokes:
spiketimes = [spiketimes, ...
@ -30,13 +26,8 @@ function rasterplot(spikes, tmax)
trials = trials(:);
% plotting this is lightning fast:
plot(spiketimes, trials, 'k')
if in_msecs
xlabel('Time [ms]');
xlim([0.0 1000.0*tmax]);
else
xlabel('Time [s]');
xlim([0.0 tmax]);
end
xlabel('Time [s]');
xlim([0.0 tmax]);
ylabel('Trials');
ylim([0.3 ntrials+0.7]);
end

View File

@ -55,7 +55,7 @@
\end{solution}
\newsolutionpage
\part Write a function that illustrated the spike times of the
\part Write a function that displays the spike times of the
first $t_{max}$ seconds in a raster plot. Each spike train is one
row in the raster plot. Each spike is a vertical line at the time
of the spike. When appropriate, the function should use milliseconds