\documentclass[12pt,a4paper,pdftex]{exam} \usepackage[german]{babel} \usepackage{pslatex} \usepackage[mediumspace,mediumqspace]{SIunits} % \ohm, \micro \usepackage{xcolor} \usepackage{graphicx} \usepackage[breaklinks=true,bookmarks=true,bookmarksopen=true,pdfpagemode=UseNone,pdfstartview=FitH,colorlinks=true,citecolor=blue]{hyperref} %%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry} \pagestyle{headandfoot} \ifprintanswers \newcommand{\stitle}{: Solutions} \else \newcommand{\stitle}{} \fi \header{{\bfseries\large Exercise 7\stitle}}{{\bfseries\large Plotting}}{{\bfseries\large November 20, 2019}} \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} %%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{listings} \lstset{ language=Matlab, basicstyle=\ttfamily\footnotesize, numbers=left, numberstyle=\tiny, title=\lstname, showstringspaces=false, commentstyle=\itshape\color{darkgray}, breaklines=true, breakautoindent=true, columns=flexible, frame=single, xleftmargin=1em, xrightmargin=1em, aboveskip=10pt } %%%%% math stuff: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{amsmath} \usepackage{amssymb} \usepackage{bm} \usepackage{dsfont} \newcommand{\naZ}{\mathds{N}} \newcommand{\gaZ}{\mathds{Z}} \newcommand{\raZ}{\mathds{Q}} \newcommand{\reZ}{\mathds{R}} \newcommand{\reZp}{\mathds{R^+}} \newcommand{\reZpN}{\mathds{R^+_0}} \newcommand{\koZ}{\mathds{C}} %%%%% page breaks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\continue}{\ifprintanswers% \else \vfill\hspace*{\fill}$\rightarrow$\newpage% \fi} \newcommand{\continuepage}{\ifprintanswers% \newpage \else \vfill\hspace*{\fill}$\rightarrow$\newpage% \fi} \newcommand{\newsolutionpage}{\ifprintanswers% \newpage% \else \fi} %%%%% new commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\qt}[1]{\textbf{#1}\\} \newcommand{\pref}[1]{(\ref{#1})} \newcommand{\extra}{--- Zusatzaufgabe ---\ \mbox{}} \newcommand{\code}[1]{\texttt{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \input{instructions} \begin{questions} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \question \qt{Graphical display of behavioral data.} In this task you will use the MATLAB plotting system to display different aspects of experimental data. In the accompanying zip file (``experiment.zip'') you find the results of an (hypothetical) behavioral experiment. Animals have been trained in a number of ``sessions'' in a two-alternative-forced choice task. The results of each session and each subject are stored in separate ``.mat'' files that are named according to the pattern \verb+Animal_{id}_Session_{id}.mat+. Each of these mat files contains three variables \verb+performance, perf_std, trials, tasks+ which list the subjects average performance, the standard deviation, the number of completed trials, and the tasks, respectively. As a first step accustom yourself with the data structure and open a single file to understand what is stored. Solve the assignments below in separate functions. Create a script that controls the analysis. Try to use as little ``hardcode'' as possible. All plots must be properly labeled, use a font size of 10\,pt for axis labels and a font size of 8\,pt for tick-labels and legends. Single-panel figures should have the paper size of 7.5 by 7.5\,cm, multi-panel figures, may use a width of 17.5\,cm and a height of 15\,cm. Save the figures in the pdf format. \begin{parts} \part{} Find out the ids of the used subjects (you will need this information later). Use the \verb+dir+ function to get the name of a mat file. \part{} Use the \verb+dir+ function to find out how many sessions have been recorded for each subject. Plot the results in a bar plot, adhere to the instructions above and save the figure. \part{} Each animal has been tested in the same tasks. Create a figure which plots each subject's performance as a function of the session number. The figure is supposed to display the three tasks in three subplots. Within each subplot plot the average performance and the performance error. \part{} Not every subject solved the same number of trials. Collect for each subject and each task the total number of trials and plot the data in form of a stacked bar plot. That is, the figure shows a stacked bar for each subject. \end{parts} %\begin{solution} % \lstinputlisting{mlestd.m} % \includegraphics[width=1\textwidth]{mlestd}\\ % \end{solution} \end{questions} \end{document}