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

\usepackage[german]{babel}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage[small]{caption}
\usepackage{sidecap}
\usepackage{pslatex}
\usepackage{amsmath}
\usepackage{amssymb}
\setlength{\marginparwidth}{2cm}
\usepackage[breaklinks=true,bookmarks=true,bookmarksopen=true,pdfpagemode=UseNone,pdfstartview=FitH,colorlinks=true,citecolor=blue]{hyperref}

%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot} \header{{\bfseries\large Exercise
    }}{{\bfseries\large Time-dependent firing rate}}{{\bfseries\large January, 14, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
  jan.grewe@uni-tuebingen.de} \runningfooter{}{\thepage}{}

\setlength{\baselineskip}{15pt}
\setlength{\parindent}{0.0cm}
\setlength{\parskip}{0.3cm}
\renewcommand{\baselinestretch}{1.15}

\newcommand{\code}[1]{\texttt{#1}}
\renewcommand{\solutiontitle}{\noindent\textbf{Solution}\par\noindent}

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

\vspace*{-6.5ex}
\begin{center}
  \textbf{\Large Introduction to scientific computing.}\\[1ex]
  {\large Jan Grewe, Jan Benda}\\[-3ex]
  Abteilung Neuroethologie \hfill --- \hfill Institut f\"ur Neurobiologie \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\
\end{center}

\begin{questions}
  \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). Use the \code{lifoustim.mat}. The dataset
  contains 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.

  \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.
    \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.
  \end{parts}

  \question{} As before but use 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.

  \question{} Some trials are different than the others.
  \begin{parts}
    \part{} Use a rasterplot to identify them. In which sense
    are they different? Save the rasterplot in pdf
    format. Use the same figure specifications as above and make sure it is properly labeled.
    \part{} Identify those trials in which the spike count
    deviates more than $2\sigma$ (twice the standard deviation) from the average.
  \end{parts}
\end{questions}

\end{document}