\documentclass[12pt,a4paper,pdftex]{exam}

\newcommand{\exercisetopic}{Time-dependent firing rates}
\newcommand{\exercisenum}{12}
\newcommand{\exercisedate}{January 19th, 2021}

\input{../../exercisesheader}

\firstpagefooter{Dr. Jan Grewe}{}{jan.grewe@uni-tuebingen.de}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\input{../../exercisestitle}

\begin{questions}
  \question  The dataset \code{lifoustim.mat} contains the responses of a (model) neuron to a time-varying stimulus. 
  The dataset stores three variables: 1st the spike times in different trials,
  2nd the stimulus, and 3rd the temporal resolution of the recording. The total
  duration of each trial is 30 seconds.
  
  \question{} Some trials are different than the others.
  \begin{parts}
    \part Use a rasterplot to identify them. In which sense
    are they different?
    \part Extend your program that it saves the figure with the width and height of 8.5\,cm using a fontsize of 10\,pt for labels.
    See Chapter 3 in the script, or browse the Matlab help for more
    information. Store the figure in pdf format.
  
    \part Identify those trials in which the spike count
    deviates more than $2\sigma$ (twice the standard deviation) from the average.
  \end{parts}
  
  
  \question Plot the time-dependent firing rate of a neuron. Calculate
  the firing rate from the \emph{instantaneous firing rate} (based on the
  interspike interval).

  \begin{parts}
    \part Write a function that takes three arguments: the spike
    times of a single trial, the trial duration and the temporal
    resolution. The function should return two variables: the time axis and the
    time-dependent firing rate.
    \part Write a script that applies the above function to estimate
    the time-dependent firing rate of each trial. Plot the firing rates of the individual responses
    and the average response as a function of time into the same graph. Save the figure in pdf
    format. Use the same figure specifications as above and make sure it is properly labeled.
  \end{parts}

  \question{} As before but estimate the "PSTH" using the binning method.

  \question{} Extend your script that it also plots the interspike
  interval histogram and the distribution of spike counts into
  separate figures. Save the figures to file using the pdf format. You may also choose to use subplots instead of individual figures.
  

  
\end{questions}

\end{document}