diff --git a/debugging/lecture/debugging.tex b/debugging/lecture/debugging.tex index 6b61096..361f5f6 100644 --- a/debugging/lecture/debugging.tex +++ b/debugging/lecture/debugging.tex @@ -1,7 +1,10 @@ \chapter{Debugging} -When we write a program from scratch we almost always make -mistakes. Accordingly a quite substantial amount of time is invested +\centerline{\includegraphics[width=0.7\textwidth]{xkcd_debugger}\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}\vspace{4ex} + + +When writing a program from scratch we almost always make +mistakes. Accordingly, a quite substantial amount of time is invested into finding and fixing errors. This process is called \codeterm{debugging}. Don't be frustrated that a self-written program does not work as intended and produces errors. It is quite exceptional @@ -14,9 +17,40 @@ some hints that help to minimize errors. \section{Types of errors and error messages} -There are a number of different classes of programming errors. +There are a number of different classes of programming errors and it +is good to know the common ones. When we make a programming error +there are some that will lead to corrupted syntax, or invalid +operations and \matlab{} will \codeterm{throw} an error. Throwing an +error ends the execution of a program and there will be an error +messages shown in the command window. With such messages \matlab{} +tries to explain what went wrong and provide a hint on the possible +cause. + +Bugs that lead to the termination of the execution may be annoying but +are generally easier to find and fix than logical errors that stay +hidden and the results of, e.g. an analysis, are seemingly correct. + +\begin{important}[Try --- catch] +There are ways to \codeterm{catch} errors during \codeterm{runtime} +(i.e. when the program is executed) and handle them in the program. + +\begin{lstlisting}[label=trycatch, caption={Try catch clause}] + try + y = function_that_throws_an_error(x); + catch + y = 0; + end +\end{lstlisting} + +This way of solving errors may seem rather convenient but is +risky. Having a function throwing an error and catching it in the +\codeterm{catch} clause will keep your command line clean but may +obscure logical errors! Take care when using the \codeterm{try-catch + clause}. +\end{important} + -\paragraph{\codeterm{Syntax error}:} +\subsection{\codeterm{Syntax error}} The most common and easiest to fix type of error. A syntax error violates the rules (spelling and grammar) of the programming language. For example every opening parenthesis must be matched by a @@ -28,26 +62,94 @@ the editor will point out and highlight most \codeterm{syntax error}s. >> mean(random_numbers | Error: Expression or statement is incorrect--possibly unbalanced (, {, or [. - + Did you mean: >> mean(random_numbers) \end{lstlisting} +\subsection{\codeterm{Indexing error}} +Second on the list of common errors are the indexing errors. Usually +\matlab{} gives rather precise infromation about the cause, once you +know what they mean. Consider the following code. + +\begin{lstlisting}[label=indexerror, caption={Indexing errors.}] +>> my_array = (1:100); +>> % first try: index 0 +>> my_array(0) +Subscript indices must either be real positive integers or logicals. + +>> % second try: negative index +>> my_array(-1) +Subscript indices must either be real positive integers or logicals. + +>> % third try: a floating point number +>> my_array(5.7) +Subscript indices must either be real positive integers or logicals. + +>> % fourth try: a character +>> my_array('z') +Index exceeds matrix dimensions. + +>> % fifth try: another character +>> my_array('A') +ans = + 65 % wtf ?!? +\end{lstlisting} + +The first two indexing attempts in listing \ref{indexerror_listing} +are rather clear. We are trying to access elements with indices that +are invalid. Remember, indices in \matlab{} start with 1. Negative +numbers and zero are not permitted. In the third attemp we index +using a floating point number. This fails because indices have to be +'integer' values. Using a character as an index (fourth attempt) +leads to a different error message that says that the index exceeds +the matrix dimensions. This indicates that we are trying to read data +behind the length of our variable \codevar{my\_array} which has 100 +elements. +One could have expected that the character is an invalid index, but +apparently it is valid but simply too large. The fith attempt +finally succeeds. But why? \matlab{} implicitely converts the +\codeterm{char} to a number and uses this number to address the +element in \varcode{my\_array}. + +\subsection{\codeterm{Assignment error}} +This error occurs when we want to write data into a vector. -\Paragraph{\codeterm{Indexing error}:} -\paragraph{\codeterm{Assignment error}:} \paragraph{Name error:} \paragraph{Arithmetic error:} -\paragraph{Logical error:} - -\section{Avoiding errors} +\section{Logical error} +Sometimes a program runs smoothly and terminates without any +error. This, however, does not necessarily mean that the program is +correct. We may have made a \codeterm{logical error}. Logical errors +are hard to find, \matlab{} has no chance to find this error and can +not help us fixing bugs origination from these. We are on our own but +there are a few strategies that should help us. + +\begin{enumerate} +\item Be sceptical: especially when a program executes without any + complaint on the first try. +\item Clean code: Structure your code that you can easily read + it. Comment, but only where necessary. Correctly indent your + code. Use descriptive variable and function names. +\item Keep it simple (below). +\item Read error messages, try to understand what \matlab{} wants to + tell. +\item Use scripts and functions and call them from the command + line. \matlab{} can then provide you with more information. It will + then point to the line where the error happens. +\item If you still find yourself in trouble: Apply debugging + strategies to find and fix bugs (below). +\end{enumerate} + + +\subsection{Avoiding errors} It would be great if we could just sit down write a program, run it and be done. Most likely this will not happen. Rather, we will make mistakes and have to bebug the code. There are a few guidelines that help to reduce the number of errors. -\subsection{Keep it small and simple} +\subsection{The Kiss principle: 'Keep it small and simple' or 'simple and stupid'} \shortquote{Debugging time increases as a square of the program's size.}{Chris Wenham} @@ -67,15 +169,15 @@ the script is just hard. when you write it, how will you ever debug it?}{Brian Kernighan} Many tasks within an analysis can be squashed into a single line of -code. This saves some space in the file, reduces the effort of coming up -with variable names and simply looks so much more competent than a +code. This saves some space in the file, reduces the effort of coming +up with variable names and simply looks so much more competent than a collection of very simple lines. Consider the following listing (listing~\ref{easyvscomplicated}). Both parts of the listing solve the same problem but the second one breaks the task down to a sequence of -easy-to-understand commands. Finding logical and also syntactic errors is -much easier in the second case. The first version is perfectly fine -but it requires a deep understanding of the applied -functions and also the task at hand. +easy-to-understand commands. Finding logical and also syntactic errors +is much easier in the second case. The first version is perfectly fine +but it requires a deep understanding of the applied functions and also +the task at hand. \begin{lstlisting}[label=easyvscomplicated, caption={Converting a series of spike times into the firing rate as a function of time. Many tasks can be solved with a single line of code. But is this readable?}] % the one-liner @@ -88,13 +190,13 @@ rate(spike_indices) = 1; rate = conv(rate, kernel, 'same'); \end{lstlisting} -The preferred way depends on several considerations. (i) -How deep is your personal understanding of the programming language? -(ii) What about the programming skills of your target audience or -other people that may depend on your code? (iii) Is one solution -faster or uses less resources than the other? (iv) How much do you -have to invest into the development of the most elegant solution -relative to its importance in the project? The decision is up to you. +The preferred way depends on several considerations. (i) How deep is +your personal understanding of the programming language? (ii) What +about the programming skills of your target audience or other people +that may depend on your code? (iii) Is one solution faster or uses +less resources than the other? (iv) How much do you have to invest +into the development of the most elegant solution relative to its +importance in the project? The decision is up to you. \subsection{Read error messages carefully and call programs from the command line.} diff --git a/header.tex b/header.tex index 66390a4..34627cc 100644 --- a/header.tex +++ b/header.tex @@ -2,12 +2,12 @@ %%%%% title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{\textbf{\huge\sffamily\tr{Introduction to\\[1ex] Scientific Computing}{Einf\"uhrung in die\\[1ex] wissenschaftliche Datenverarbeitung}}} \author{{\LARGE Jan Grewe \& Jan Benda}\\[5ex]Abteilung Neuroethologie\\[2ex]\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}\vspace{3ex}} -\date{WS 15/16\\\vfill \centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}} +\date{WS 2017/2018\\\vfill \centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}} %%%% language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \newcommand{\tr}[2]{#1} % en % \usepackage[english]{babel} -\newcommand{\tr}[2]{#2} % de +\newcommand{\tr}[2]{#1} % en \usepackage[ngerman, english]{babel} %%%% encoding %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/plotting/lecture/plotting-chapter.tex b/plotting/lecture/plotting-chapter.tex index 4261202..64c5743 100644 --- a/plotting/lecture/plotting-chapter.tex +++ b/plotting/lecture/plotting-chapter.tex @@ -19,12 +19,15 @@ \section{TODO} \begin{itemize} \item Beispiele schlechter plots sollten mehr Bezug zu den Typen von - plots haben, die wir machen! + plots haben, die wir machen! Check WS1617 presentations for examples. \item subplot \item Uebersicht zu wichtigen plot Befehlen (plot, scatter, bar, step, ...) \item Funktionenplotten (siehe auch Design patterns) und untersampleter Sinus -\item Verschiedene Stile fuer Achsenbeschriftung (gross/kleinschreibungen, Kalmmertyp fuer Einheiten), stay with one style! -\item Stay with a coherent style (font type/style/size, colors schemes, line styles/thickness, point styles) +\item Verschiedene Stile fuer Achsenbeschriftung (gross/kleinschreibungen, Klammertyp fuer Einheiten), stay with one style! +\item Stay with a coherent style (font type/style/size, colors schemes, line styles/thickness, point styles), same line style in all plots for the same quantity. How to do consistent line styles in matlab (python: dictionary for kwargs)? +\item Different plots for journal papers and presentations! +\item Color universal design for color blind people: + \url{http://jfly.iam.u-tokyo.ac.jp/color/} \end{itemize} \end{document} diff --git a/pointprocesses/lecture/pointprocesses-chapter.tex b/pointprocesses/lecture/pointprocesses-chapter.tex index 4570c91..2e48587 100644 --- a/pointprocesses/lecture/pointprocesses-chapter.tex +++ b/pointprocesses/lecture/pointprocesses-chapter.tex @@ -20,6 +20,11 @@ \begin{itemize} \item Add spikeraster function \item Multitrial firing rates +\item Choice of bin width for PSTH, kernel width, also in relation sto + stimulus time scale +\item Kernle firing rate: discuss different kernel shapes, in + particular causal kernels (gamma, exponential), relation to synaptic + potentials \end{itemize} \end{document} diff --git a/pointprocesses/lecture/pointprocesses.tex b/pointprocesses/lecture/pointprocesses.tex index 8437aa4..2ed57e0 100644 --- a/pointprocesses/lecture/pointprocesses.tex +++ b/pointprocesses/lecture/pointprocesses.tex @@ -113,7 +113,7 @@ heisen die Intervalle auch \determ{Interspikeintervalle} \frac{\sigma_{ISI}^2}{2\mu_{ISI}^3}$. \end{itemize} -\begin{exercise}{isiHist.m}{} +\begin{exercise}{isihist.m}{} Schreibe eine Funktion \code{isiHist()}, die einen Vektor mit Interspikeintervallen entgegennimmt und daraus ein normiertes Histogramm der Interspikeintervalle berechnet. diff --git a/pointprocesses/lecture/pointprocessscetchA.tex b/pointprocesses/lecture/pointprocessscetchA.tex deleted file mode 100644 index 302b6a9..0000000 --- a/pointprocesses/lecture/pointprocessscetchA.tex +++ /dev/null @@ -1,95 +0,0 @@ -% GNUPLOT: LaTeX picture with Postscript -\begingroup - \makeatletter - \providecommand\color[2][]{% - \GenericError{(gnuplot) \space\space\space\@spaces}{% - Package color not loaded in conjunction with - terminal option `colourtext'% - }{See the gnuplot documentation for explanation.% - }{Either use 'blacktext' in gnuplot or load the package - color.sty in LaTeX.}% - \renewcommand\color[2][]{}% - }% - \providecommand\includegraphics[2][]{% - \GenericError{(gnuplot) \space\space\space\@spaces}{% - Package graphicx or graphics not loaded% - }{See the gnuplot documentation for explanation.% - }{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}% - \renewcommand\includegraphics[2][]{}% - }% - \providecommand\rotatebox[2]{#2}% - \@ifundefined{ifGPcolor}{% - \newif\ifGPcolor - \GPcolortrue - }{}% - \@ifundefined{ifGPblacktext}{% - \newif\ifGPblacktext - \GPblacktexttrue - }{}% - % define a \g@addto@macro without @ in the name: - \let\gplgaddtomacro\g@addto@macro - % define empty templates for all commands taking text: - \gdef\gplbacktext{}% - \gdef\gplfronttext{}% - \makeatother - \ifGPblacktext - % no textcolor at all - \def\colorrgb#1{}% - \def\colorgray#1{}% - \else - % gray or color? - \ifGPcolor - \def\colorrgb#1{\color[rgb]{#1}}% - \def\colorgray#1{\color[gray]{#1}}% - \expandafter\def\csname LTw\endcsname{\color{white}}% - \expandafter\def\csname LTb\endcsname{\color{black}}% - \expandafter\def\csname LTa\endcsname{\color{black}}% - \expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}% - \expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}% - \expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}% - \expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}% - \expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}% - \expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}% - \expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}% - \expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}% - \expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}% - \else - % gray - \def\colorrgb#1{\color{black}}% - \def\colorgray#1{\color[gray]{#1}}% - \expandafter\def\csname LTw\endcsname{\color{white}}% - \expandafter\def\csname LTb\endcsname{\color{black}}% - \expandafter\def\csname LTa\endcsname{\color{black}}% - \expandafter\def\csname LT0\endcsname{\color{black}}% - \expandafter\def\csname LT1\endcsname{\color{black}}% - \expandafter\def\csname LT2\endcsname{\color{black}}% - \expandafter\def\csname LT3\endcsname{\color{black}}% - \expandafter\def\csname LT4\endcsname{\color{black}}% - \expandafter\def\csname LT5\endcsname{\color{black}}% - \expandafter\def\csname LT6\endcsname{\color{black}}% - \expandafter\def\csname LT7\endcsname{\color{black}}% - \expandafter\def\csname LT8\endcsname{\color{black}}% - \fi - \fi - \setlength{\unitlength}{0.0500bp}% - \begin{picture}(6462.00,1700.00)% - \gplgaddtomacro\gplbacktext{% - \csname LTb\endcsname% - \put(6329,421){\makebox(0,0){\strut{}Time}}% - \put(910,270){\makebox(0,0){\strut{}$t_{1}$}}% - \put(1412,270){\makebox(0,0){\strut{}$t_{2}$}}% - \put(2123,270){\makebox(0,0){\strut{}$t_{3}$}}% - \put(2413,270){\makebox(0,0){\strut{}$t_{4}$}}% - \put(2717,270){\makebox(0,0){\strut{}$t_{5}$}}% - \put(3167,270){\makebox(0,0){\strut{}$t_{6}$}}% - \put(4033,270){\makebox(0,0){\strut{}$t_{7}$}}% - \put(4650,270){\makebox(0,0){\strut{}$t_{8}$}}% - \put(5685,270){\makebox(0,0){\strut{}$t_{9}$}}% - }% - \gplgaddtomacro\gplfronttext{% - }% - \gplbacktext - \put(0,0){\includegraphics{pointprocessscetchA}}% - \gplfronttext - \end{picture}% -\endgroup diff --git a/pointprocesses/lecture/pointprocessscetchB.tex b/pointprocesses/lecture/pointprocessscetchB.tex deleted file mode 100644 index 14803c3..0000000 --- a/pointprocesses/lecture/pointprocessscetchB.tex +++ /dev/null @@ -1,130 +0,0 @@ -% GNUPLOT: LaTeX picture with Postscript -\begingroup - \makeatletter - \providecommand\color[2][]{% - \GenericError{(gnuplot) \space\space\space\@spaces}{% - Package color not loaded in conjunction with - terminal option `colourtext'% - }{See the gnuplot documentation for explanation.% - }{Either use 'blacktext' in gnuplot or load the package - color.sty in LaTeX.}% - \renewcommand\color[2][]{}% - }% - \providecommand\includegraphics[2][]{% - \GenericError{(gnuplot) \space\space\space\@spaces}{% - Package graphicx or graphics not loaded% - }{See the gnuplot documentation for explanation.% - }{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}% - \renewcommand\includegraphics[2][]{}% - }% - \providecommand\rotatebox[2]{#2}% - \@ifundefined{ifGPcolor}{% - \newif\ifGPcolor - \GPcolortrue - }{}% - \@ifundefined{ifGPblacktext}{% - \newif\ifGPblacktext - \GPblacktexttrue - }{}% - % define a \g@addto@macro without @ in the name: - \let\gplgaddtomacro\g@addto@macro - % define empty templates for all commands taking text: - \gdef\gplbacktext{}% - \gdef\gplfronttext{}% - \makeatother - \ifGPblacktext - % no textcolor at all - \def\colorrgb#1{}% - \def\colorgray#1{}% - \else - % gray or color? - \ifGPcolor - \def\colorrgb#1{\color[rgb]{#1}}% - \def\colorgray#1{\color[gray]{#1}}% - \expandafter\def\csname LTw\endcsname{\color{white}}% - \expandafter\def\csname LTb\endcsname{\color{black}}% - \expandafter\def\csname LTa\endcsname{\color{black}}% - \expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}% - \expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}% - \expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}% - \expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}% - \expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}% - \expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}% - \expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}% - \expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}% - \expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}% - \else - % gray - \def\colorrgb#1{\color{black}}% - \def\colorgray#1{\color[gray]{#1}}% - \expandafter\def\csname LTw\endcsname{\color{white}}% - \expandafter\def\csname LTb\endcsname{\color{black}}% - \expandafter\def\csname LTa\endcsname{\color{black}}% - \expandafter\def\csname LT0\endcsname{\color{black}}% - \expandafter\def\csname LT1\endcsname{\color{black}}% - \expandafter\def\csname LT2\endcsname{\color{black}}% - \expandafter\def\csname LT3\endcsname{\color{black}}% - \expandafter\def\csname LT4\endcsname{\color{black}}% - \expandafter\def\csname LT5\endcsname{\color{black}}% - \expandafter\def\csname LT6\endcsname{\color{black}}% - \expandafter\def\csname LT7\endcsname{\color{black}}% - \expandafter\def\csname LT8\endcsname{\color{black}}% - \fi - \fi - \setlength{\unitlength}{0.0500bp}% - \begin{picture}(6462.00,3740.00)% - \gplgaddtomacro\gplbacktext{% - \csname LTb\endcsname% - \put(122,3587){\makebox(0,0)[l]{\strut{}\normalsize Event times $\{t_i\}$}}% - \put(6329,2947){\makebox(0,0){\strut{}Time}}% - \put(910,2865){\makebox(0,0){\strut{}$t_{1}$}}% - \put(1412,2865){\makebox(0,0){\strut{}$t_{2}$}}% - \put(2123,2865){\makebox(0,0){\strut{}$t_{3}$}}% - \put(2413,2865){\makebox(0,0){\strut{}$t_{4}$}}% - \put(2717,2865){\makebox(0,0){\strut{}$t_{5}$}}% - \put(3167,2865){\makebox(0,0){\strut{}$t_{6}$}}% - \put(4033,2865){\makebox(0,0){\strut{}$t_{7}$}}% - \put(4650,2865){\makebox(0,0){\strut{}$t_{8}$}}% - \put(5685,2865){\makebox(0,0){\strut{}$t_{9}$}}% - }% - \gplgaddtomacro\gplfronttext{% - }% - \gplgaddtomacro\gplbacktext{% - \csname LTb\endcsname% - \put(122,2465){\makebox(0,0)[l]{\strut{}\normalsize Intervals $\{T_i\}, \; T_i = t_{i+1} - t_i$}}% - \put(6329,1825){\makebox(0,0){\strut{}Time}}% - \put(1161,1770){\makebox(0,0){\strut{}$T_{1}$}}% - \put(1767,1770){\makebox(0,0){\strut{}$T_{2}$}}% - \put(2268,1770){\makebox(0,0){\strut{}$T_{3}$}}% - \put(2565,1770){\makebox(0,0){\strut{}$T_{4}$}}% - \put(2942,1770){\makebox(0,0){\strut{}$T_{5}$}}% - \put(3600,1770){\makebox(0,0){\strut{}$T_{6}$}}% - \put(4341,1770){\makebox(0,0){\strut{}$T_{7}$}}% - \put(5168,1770){\makebox(0,0){\strut{}$T_{8}$}}% - }% - \gplgaddtomacro\gplfronttext{% - }% - \gplgaddtomacro\gplbacktext{% - \colorrgb{0.00,0.00,0.00}% - \put(333,268){\makebox(0,0)[r]{\strut{}$0$}}% - \colorrgb{0.00,0.00,0.00}% - \put(333,460){\makebox(0,0)[r]{\strut{}$2$}}% - \colorrgb{0.00,0.00,0.00}% - \put(333,652){\makebox(0,0)[r]{\strut{}$4$}}% - \colorrgb{0.00,0.00,0.00}% - \put(333,844){\makebox(0,0)[r]{\strut{}$6$}}% - \colorrgb{0.00,0.00,0.00}% - \put(333,1036){\makebox(0,0)[r]{\strut{}$8$}}% - \colorrgb{0.00,0.00,0.00}% - \put(333,1228){\makebox(0,0)[r]{\strut{}$10$}}% - \csname LTb\endcsname% - \put(122,1487){\makebox(0,0)[l]{\strut{}\normalsize Event counts $\{ n_i \}$}}% - \put(6329,57){\makebox(0,0){\strut{}Time}}% - }% - \gplgaddtomacro\gplfronttext{% - }% - \gplbacktext - \put(0,0){\includegraphics{pointprocessscetchB}}% - \gplfronttext - \end{picture}% -\endgroup diff --git a/programming/exercises/boolean_logical_indexing_de.tex b/programming/exercises/boolean_logical_indexing_de.tex new file mode 100644 index 0000000..9f0d3e5 --- /dev/null +++ b/programming/exercises/boolean_logical_indexing_de.tex @@ -0,0 +1,108 @@ +\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 \"Ubung + 3}}{{\bfseries\large Boolesche Ausdr\"ucke, logisches + Indizieren}}{{\bfseries\large 31. Oktober, 2016}} +\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}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\vspace*{-6.5ex} +\begin{center} + \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[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} + +Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster:\newline +``boolesche\_ausdruecke\_\{nachname\}.m'' benannt werden +(z.B. variablen\_datentypen\_mueller.m). + +\section{Boolesche Ausdr\"ucke} + +\begin{questions} + \question Gegeben sind zwei Vektoren \verb+x = [1 5 2 8 9 0 1]+ und + \verb+y = [5 2 2 6 0 0 2]+. F\"uhre aus und erkl\"are. + \begin{parts} + \part \verb+x > y+ + \part \verb+y < x+ + \part \verb+x == y+ + \part \verb+x ~= y+ + \part \verb+x & ~y+ + \part \verb+x | y+ + \end{parts} + + \question Finde heraus, was die Funktionen \verb+bitand+ und \verb+bitor+ machen. + \begin{parts} + \part F\"uhre aus und erkl\"are: \verb+bitand(10, 8)+ + \part F\"uhre aus und erkl\"are: \verb+bitor(10, 8)+ + \end{parts} +\item Implementiere folgende Boolesche Ausdr\"ucke. Teste mit + zuf\"alligen ganzzahlingen Werten f\"ur \verb+x+ und \verb+y+. + \begin{parts} + \part Das Ergebnis sei wahr, wenn \verb+x+ gr\"o{\ss}er als \verb+y+ und die + Summe aus \verb+x+ und \verb+y+ nicht kleiner als 100 ist. + \part Das Ergebnis sei wahr, wenn \verb+x+ und \verb+y+ ungleich 0 + oder \verb+x+ und \verb+y+ gleich sind. + \end{parts} +\end{questions} + +\newpage +\section{Logische Indizierung} + +Boolesche Ausdr\"ucke k\"onnen benutzt werden um aus Vektoren und +Matrizen die Elemente herauszusuchen, die einem bestimmeten Kriterium +entsprechen. + +\begin{questions} + \question Gegeben sind \verb+x = (1:10)+ und + \verb+y = [3 1 5 6 8 2 9 4 7 0]+. Versuche die Ausgaben folgender + Anweisungen zu verstehen. Erkl\"are die Ergebnisse. + \begin{parts} + \part \verb+x < 5+ + \part \verb+x( x < 5) )+ + \part \verb+x( (y <= 2) )+ + \part \verb+x( (x > 2) | (y < 8) )+ + \part \verb+x( (x == 0) & (y == 0) )+ + \end{parts} + + \question Teste den Zufallsgenerator: + \begin{parts} + \part Erzeuge eine 100x100 2-D Matrize mit Zufallswerten zwischen + 0 und 100 (\verb+randi+). Ersetze die Werte der Elemente, die in + folgende Klassen fallen: \verb+x < 33+ mit 0, + \verb+x >= 33 und x < 66+ mit 1 und alle \verb+x >= 66+ auf 2. + \part Ermittle die Anzahl Elemente f\"ur jede Klasse mithilfe eines + Booleschen Ausdrucks (\verb+sum+ kann eingesetzt werden um die + Anzahl Treffer zu ermitteln). + \end{parts} +\end{questions} + +\end{document} diff --git a/programming/exercises/control_flow_de.tex b/programming/exercises/control_flow_de.tex new file mode 100644 index 0000000..bfb1cd4 --- /dev/null +++ b/programming/exercises/control_flow_de.tex @@ -0,0 +1,138 @@ +\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 \"Ubung 4}}{{\bfseries\large Kontrollstrukturen}}{{\bfseries\large 08. November, 2016}} +\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}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\vspace*{-6.5ex} +\begin{center} + \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[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} + +Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster: +``control\_flow\_\{nachname\}.m'' benannt werden +(z.B. control\_flow\_mueller.m). + +\begin{questions} + \question Implementiere \code{for} Schleifen bei denen die Laufvariable: + \begin{parts} + \part ... von 0 bis 10 l\"auft. Gib den Wert der Laufvariable im + Schleifenk\"orper aus. + \part ... von 10 bis 0 l\"auft. Gib den Wert der Laufvariable aus. + \part ... von 0 bis 1 in einer Schrittweite von 0.1 l\"auft. Gib + die Laufvariable aus. + \end{parts} + + \question Zugriff auf Elemente in Vektoren: + \begin{parts} + \part Definiere einen Vektor \code{x} mit Werten von 1:100. + \part Benutze eine \code{for} Schleife um jedes Element von + \code{x} auszugeben indem die Laufvariable zum indizieren benutzt wird. + \part ... gleiches nur ohne eine Laufvariable zu nutzen. + \end{parts} + + \question Erzeuge einen Vektor \verb+x+ mit 50 Zufallszahlen im + Bereich 0 - 10. + \begin{parts} + \part Benutze eine Schleife um das arithmetische Mittel zu + berechnen. Der Mittelwert ist definiert als: + $\overline{x}=\frac{1}{n}\sum\limits_{i=0}^{n}x_i $. + \part Benutze eine Schleife um die Standardabweichung zu + bestimmen: + $\sigma=\sqrt{\frac{1}{n}\sum\limits_{i=0}^{n}(x_i-\overline{x})^2}$). + \part Suche in der MATLAB Hilfe nach Funktionen, die das f\"ur + dich tun :-). + \end{parts} + + \question Implementiere eine \code{while} Schleife + \begin{parts} + \part ... die 100 mal durchlaufen wird. Gib den aktuellen + Durchlauf im Schleifenk\"orper aus. + \part ... die endlos l\"auft. Sie kann mir \code{Strg + C} + abgebrochen werden. + \end{parts} + + \question Nutze eine endlose \code{while} Schleife um einzeln die + Elemente eines Vektor der L\"ange 10 auszugeben. + + \question Benutze eine endlose \verb+while+ Schleife um so lange + Zufallszahlen (\verb+randn+) zu ziehen, bis eine Zahl gr\"o{\ss}er + 1.33 gezogen wurde. + \begin{parts} + \part Z\"ahle die Anzahl n\"otiger Versuche. + \part Nuzte eine \code{for} Schleife um den vorherigen Test + 1000 mal laufen zu lassen. Merke Dir alle Anzahlen und berechne den + Mittelwert davon. + \part Plotte die Anzahl notwendiger Versuche. + \part Spiele mit der Schwelle, was passiert? + \end{parts} + + \question Erstelle \verb+x+ einen Vektor mit 10 Zufallszahlen im + Bereich 0:10. + \begin{parts} + \part Benutze eine \code{for} Schleife um all die Elemente zu + loeschen (\code{x(index) = [];}), die kleiner als 5 sind. + \part Loesche alle Elemente die kleiner als 5 und groesser als 2 + sind. + \part Kann man das gleiche auch ohne eine Schleife erledigen? + \end{parts} + + \question Teste den Zufallsgenerator! Dazu z\"ahle die Anzahl der + Elemente, die durch folgende Grenzen getrennt werden [0.0, 0.2, + 0.4, 0.6, 0.8, 1.0]. Speichere die Ergebnisse in einem passenden + Vektor. Nutze eine Schleife um 1000 Zufallszahlen mit + \verb+rand()+ (siehe Hilfe) zu ziehen. Was waere die Erwartung, + was kommt heraus? + + \question String parsing: Mitunter werden Dateinamen von + Datens\"atzen benutzt um anzuzeigen, unter welchen Bedingungen die + Daten gewonnen wurden. Man muss also den Dateinamen parsen und die + f\"ur einen relevante Information herausfiltern. + \begin{parts} + \part Erstelle eine Variable + \verb+filename = '2015-10-12_100Hz_1.25V.dat'+. Der Unterstrich + ist offensichtlich das verwendete Trennzeichen. + \part Benutze eine \verb+for+ Schleife um durch alle Zeichen zu + laufen. Vergleiche jedes Zeichen mit dem Unterstrich und merke + Dir die Positionen in einem Vektor. + \part Benutze eine zweite Schleife um durch diesen + Positionsvektor zu laufen und benutze die darin enthaltene + Information um den \code{filename} in Teile zu schneiden. + \part Gib die einzelnen Teile auf dem Bildschirm aus. + \end{parts} + +\end{questions} + +\end{document} diff --git a/programming/exercises/scripts_functions_de.tex b/programming/exercises/scripts_functions_de.tex new file mode 100644 index 0000000..6ef775b --- /dev/null +++ b/programming/exercises/scripts_functions_de.tex @@ -0,0 +1,219 @@ +\documentclass[12pt,a4paper,pdftex]{exam} +%\documentclass[answers,12pt,a4paper,pdftex]{exam} + +\usepackage[german]{babel} +\usepackage{natbib} +\usepackage{xcolor} +\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 \"Ubung 5}}{{\bfseries\large Skripte und Funktionen}}{{\bfseries\large 15. November, 2016}} +\firstpagefooter{Prof. Jan Benda}{Phone: 29 74 573}{Email: + jan.benda@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 +} + + +\newcommand{\code}[1]{\texttt{#1}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\vspace*{-6.5ex} +\begin{center} + \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[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} + +Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +werden. Im Gegensatz zu den vorherigen \"Ubungsbl\"attern k\"onnen die +L\"osungen nicht mehr in einer Datei gemacht werden. Die L\"osungen +also als zip-Archiv auf ILIAS hochladen. Das Archiv sollte nach dem Muster: +``skripte\_funktionen\_\{nachname\}.zip'' benannt werden. + +\begin{questions} + + \question Berechne die Fakult\"at einer Zahl. + \begin{parts} + \part Version 1: Schreibe eine Skript, das die Fakult\"at von 5 berechnet und das + Resultat auf dem Bildschirm ausgibt. + \begin{solution} + \lstinputlisting{factorialscripta.m} + \end{solution} + + \part Version 2: Wie Version 1, aber als Funktion, die als + Argument die Zahl, von der die Fakult\"at berechnet werden soll, + \"ubernimmt. + \begin{solution} + \lstinputlisting{printfactorial.m} + \lstinputlisting{factorialscriptb.m} + \end{solution} + + \part Version 3: Wie Version 2, die Funktion soll den berechneten + Wert nicht ausgeben, sondern als Funktionswert zur\"uckgeben. Das + aufrufende Skript soll dann den berechneten Wert auf dem + Bildschirm ausgeben. + \begin{solution} + \lstinputlisting{myfactorial.m} + \lstinputlisting{factorialscriptc.m} + \end{solution} + + \end{parts} + + \question Grafische Darstellung einer Sinuswelle. + \begin{parts} + \part Implementiere eine Funktion, die einen Sinus mit der + Amplitude 1 und der Frequenz $f = $ 50\,Hz plottet ($\sin(2\pi \cdot + f \cdot t)$). Rufe die Funktion auf. + \begin{solution} + \lstinputlisting{plotsine50.m} + \lstinputlisting{plotsinea.m} + \end{solution} + + \part Erweitere die Funktion so, dass die L\"ange der Zeitachse, + die Amplitude, und die Frequenz als Argumente \"ubergeben werden + k\"onnen. Die Schrittweite soll in der Funktion aus der Frequenz + berechnet werden. + \begin{solution} + \lstinputlisting{plotsine.m} + \lstinputlisting{plotsineb.m} + \end{solution} + + \part Verlagere alle plot Befehle in das aufrufende Skript + und ver\"andere die Funktion so, dass sie sowohl den Sinus als + auch die Zeitachse zur\"uckgibt. + \begin{solution} + \lstinputlisting{sinewave.m} + \lstinputlisting{plotsinec.m} + \end{solution} + + \part Schreibe eine zweite Funktion, die den Sinus plotted und + daf\"ur die Zeitachse und den Sinus als Argument erh\"alt. Diese + Funktion soll die Achsen richtig beschriften. Schreibe ein kleines + Skript, dass beide Funktionen aufruft, um einen Sinus von 5\,Hz + mit der Amplitude 2 \"uber 1.5 Sekunden zu plotten. + \begin{solution} + \lstinputlisting{plotsinewave.m} + \lstinputlisting{plotsined.m} + \end{solution} + \end{parts} + + %\question Schreibe eine Funktion, die bin\"are Datens\"atze + %('signal.bin' und 'signal2.bin' vom Montag) liest und die Daten als + %Vektor zur\"uckgibt. Welche Argumente muss die Funktion + %\"ubernehmen? + + \question Random Walk. + \begin{parts} + \part Lies die Aufgabe bis zum Ende durch. \"Uberlege dir dann ein + geeignetes ``Programmlayout'' aus Funktionen und Skripten. + + Was w\"are eine geeigente Funktion f\"ur diese Aufgabe? Welche + Argumente sollte sie entgegennehmen? Was soll sie berechnen und + zur\"uckgeben? + \begin{solution} + One function that computes one realisation of a random walk. + Scripts for plotting and analysis. + \lstinputlisting{randomwalkthresh.m} + \end{solution} + + \part Simuliere und plotte die Positionen von 10 Realisationen + eines random walk mit gleichen Wahrscheinlichkeiten f\"ur beide + Richtungen. Jeder Walker startet an der Position 0 und soll so + lange laufen, bis er den Wert 50 \"uberschreitet oder den Wert + $-50$ unterschreitet. + \begin{solution} + \lstinputlisting{randomwalkscriptb.m} + \end{solution} + + \part Jetzt wollen wir die Wahrscheinlichkeit $p$ f\"ur eine + Bewegung zu gr\"o{\ss}eren Positionen im Bereich $0.5 \le p < 0.8$ + variieren. Simuliere 10 Realisationen des random walk f\"ur vier + verschiedene Wahrscheinlichkeiten. + \begin{solution} + \lstinputlisting{randomwalkscriptc.m} + \end{solution} + + \part Wie entwickelt sich die mittlere ben\"otigte Schrittanzahl + in Abh\"angigkeit der Wahrscheinlichkeit? Stelle die Mittelwerte + und die Standardabweichungen graphisch dar. + \begin{solution} + \lstinputlisting{randomwalkscriptd.m} + \end{solution} + \end{parts} + + %\question Modellierung des exponentiellen Wachstums einer isolierten + %Population. Das exponentielle Wachstum einer isolierten Population + %wird \"uber folgende Differentialgleichung beschrieben: + %\begin{equation} + % \frac{dN}{dt} = N \cdot r, + %\end{equation} + %mit $N$ der Populationsgr\"o{\ss}e und $r$ der Wachstumsrate. + %\begin{parts} + % \part L\"ose die Gleichung numerisch mit dem Euler Verfahren. + % \part Implementiere eine Funktion, die die Populationsgr\"o{\ss}e + % und die Zeit zur\"uckgibt. + % \part Plotte die Populationsgr\"o{\ss}e als Funktion der Zeit. + %\end{parts} + + %\question Etwas realistischer ist das logistische Wachstum einer + %isolierten Population, bei der das Wachstum durch eine Kapazit\"at + %gedeckelt ist. Sie wird mit folgender Differentialgleichung + %beschrieben: + %\begin{equation} + % \frac{dN}{dt} = N \cdot r \cdot \left( 1 - \frac{N}{K} \right) + %\end{equation} + %mit $N$ der Population, der Wachstumsrate $r$ und $K$ der ``tragenden'' + %Kapazit\"at. + %\begin{parts} + % \part Implementiere die L\"osung des logistischen Wachstums in + % einer Funktion. Benutze das Euler Verfahren. Die Funktion soll die + % Parameter $r$, $K$ sowie den Startwert von $N$ als Argumente + % \"ubernehmen. + % \part Die Funktion soll die Populationsgr\"o{\ss}e und die Zeit + % zur\"uckgeben. + % \part Simuliere das Wachstum mit einer Anzahl unterschiedlicher + % Startwerte f\"ur $N$. + % \part Stelle die Ergebnisse in einem Plot graphisch dar. + % \part Plotte das Wachstum $dN/dt$ als Funktion der + % Populationsgr\"o{\ss}e $N$. + %\end{parts} + +\end{questions} + +\end{document} diff --git a/programming/exercises/variables_types.tex b/programming/exercises/variables_types.tex index 5e8fdb3..acbd2cd 100644 --- a/programming/exercises/variables_types.tex +++ b/programming/exercises/variables_types.tex @@ -15,7 +15,7 @@ %%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry} \pagestyle{headandfoot} -\header{{\bfseries\large \"Ubung 1}}{{\bfseries\large Variablen und Datentypen}}{{\bfseries\large 18. Oktober, 2016}} +\header{{\bfseries\large Exercise 1}}{{\bfseries\large Variables und Datatypes}}{{\bfseries\large 17. Oktober, 2017}} \firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email: jan.grewe@uni-tuebingen.de} \runningfooter{}{\thepage}{} @@ -26,221 +26,198 @@ \renewcommand{\baselinestretch}{1.15} \newcommand{\code}[1]{\texttt{#1}} -\renewcommand{\solutiontitle}{\noindent\textbf{L\"osung:}\par\noindent} +\renewcommand{\solutiontitle}{\noindent\textbf{Solutions:}\par\noindent} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \vspace*{-6.5ex} \begin{center} - \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[1ex] + \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} \\ + Neuroethology \hfill --- \hfill Institute for Neurobiology \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\ \end{center} -Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und -Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost -werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) -im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen -``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig -voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster:\linebreak -``variablen\_datentypen\_\{nachname\}.m'' benannt werden -(z.B. variablen\_datentypen\_mueller.m). +The exercises are meant for self-monitoring, revision of the lecture +topic. You should try to solve them on your own. Your solution should +be submitted as a single script (m-file) in the Ilias system. Each +task should be solved in its own ``cell''. Each cell must be +executable on its own. The file should be named according to the following pattern: +``variables\_datatypes\_\{lastname\}.m'' benannt werden +(e.g. variables\_datentypes\_mueller.m). \begin{questions} - - \question Erzeugen und L\"oschen von Variablen: + \question Creating and deleting variables: \begin{parts} - \part Erzeuge zwei Variablen \code{a}, \code{b} und weise ihnen - unterschiedliche Werte zu. Schlie{\ss}e die Zeilen mit einem - Semikolon ab. Erstelle eine Variable \code{c} die leer ist. + \part Create two new variables \code{a}, \code{b} and assign arbitrary values to them. End each command with a semicolon. Create a variable \code{c} that is empty. \begin{solution} \code{a = 1;} \code{b = 2;} \code{c = [];} \end{solution} - \part Lass die Werte der Variablen ausgeben. + \part Print the varaibles and their content in the matlab command line \begin{solution} \code{disp(a)}; \code{disp(b)}; \code{disp(c)} \end{solution} - \part Benuzte die Kommandozeile um herauszufinden, welche Variablen - es im Workspace gibt. + \part Use the appropriate command to find out which variables have been created. \begin{solution} \code{who} \end{solution} - \part Benuzte die Kommandozeile um herauszufinden, welche Datentypen sie haben. + \part Use the appropriate command to additionally display the data type. \begin{solution} - \code{whos} oder \code{class(a)}, \code{class(b)}, \code{class(c)} + \code{whos} or \code{class(a)}, \code{class(b)}, \code{class(c)} \end{solution} - \part Finde in der Hilfe mehr Information \"uber das \code{clear} Kommando. + \part Use the help system to learn about the \code{clear} command. \begin{solution} \code{help clear} \end{solution} - \part L\"osche eine Variable. + \part Delete a single variable. \begin{solution} \code{clear a} \end{solution} - \part L\"osche alle \"ubrigen Variablen. + \part Delete all remaining variables. \begin{solution} - \code{clear all} oder einfach \code{clear} + \code{clear all} or simply \code{clear} \end{solution} \end{parts} - \question Operationen auf Variablen: + \question Working with variables: \begin{parts} - \part Erstelle die Variablen \code{a} und \code{b} und weise ihnen - beliebige Werte zu. + \part Create two new variables \code{a}, \code{b} and assign arbitrary numeric values. \begin{solution} \code{a = 5; b = 3.14;} \end{solution} - \part Addiere beliebige andere Zahlen zu den Variablen \code{a} und \code{b}. + \part Add a number to \code{a} and \code{b}. \begin{solution} \code{a + 5} \code{b + 7.28} \end{solution} - \part Addiere die Variablen. + \part Add the variables themselves. \begin{solution} \code{a + b} \end{solution} - \part Mulipliziere die Variablen miteinander. + \part Multiply \code{a} and \code{b}. \begin{solution} \code{a * b} \end{solution} - \part \"Andern sich die urspr\"unglichen Werte der Variablen? + \part Do \code{a} and \code{b} change? \begin{solution} - Nein, die Operationen benutzen die Werte der Variablen. Die - Variablen bleiben unver\"andert. + No, we make use of the stored values, the values remaing untouched. \end{solution} - \part F\"uhre eine beliebige Berechnungen mit den Variablen aus und - weise die Ergebnisse einer neuen Variable \code{x} zu. + \part Execute any arithmetic operation with \code{a} and \code{b} and store the result in a new variabel \code{x}. \begin{solution} \code{x = a * b;} \end{solution} - \part Weise \code{a} und \code{b} neue Werte zu. Hat sich etwas am - Wert von \code{x} ge\"andert? + \part Assign new values to \code{a} and \code{b}. Did \code{x} change? \begin{solution} - Nein, der Variablen \code{x} wird ein Wert zugewiesen, der sich - nicht \"andert bis der Variablen ein neuer Wert zugewiesen - wird. Die Variable 'x' speichert das Resultat der Rechnung - \textbf{nicht} die Anweisung. + No, the content of \code{x} does not change, it stores a value, \textbf{not} a recipe. \end{solution} \end{parts} - \question Berechne die Fakult\"at von 5: + \question Calculate the faculty of 5: \begin{parts} - \part Erzeuge eine Variable \code{x} und weise ihr den Wert 1 zu. - \part Berechne den ersten Schritt (\code{*2}) und weise das Ergebnis \code{x} - zu. - \part Fahre schrittweise fort, bis die Fakult\"at von 5 berechnet ist. \code{x} - sollte nun das Endergebnis enthalten. + \part Create a variable \code{x} an assign the value 1. + \part In a first step multiply \code{x} with 2 and assign the result to \code{x} itself. + \part Proceed in a similar manner until x stores $5!$. \end{parts} \begin{solution} \code{x = 1;} \\ \code{x = x * 2;}\\ \code{x = x * 3;} \\ \code{x = x * 4;} \\ \code{x = x * 5;}\\ \code{disp(x)}\\ \code{ 120} \end{solution} - \question Erstelle eine Variable, die einen beliebigen Text enth\"alt. Was - ist ihr Datentyp? + \question Create a variable and assign a string to it. What is the data type of that variable? \begin{solution} - \code{x = 'einfacher Text'}\\ \code{class(x)\\ char} + \code{x = 'some text'}\\ \code{class(x)\\ char} \end{solution} - - \question Was sind die gr\"o{\ss}ten Zahlen, die in den Integer 8, 16, 32 - und 64 bit Datentypen abgelegt werden k\"onnen? + + \question List the largest numbers that can stored in 8, 16, 32 + and 64 bit integer data types? \begin{solution} \verb+2^8 / 2 - 1+\\ \verb+2^16 / 2 - 1+\\ \verb+2^32 / 2 - 1+\\ \verb+2^64 / 2 - 1+ \end{solution} - - \question Erstelle eine Variable des 8 Bit Integer Datentyps und weise - ihr einen Wert zu. Addiere \code{300}. Welchen Wert enth\"alt nun die - Variable? Warum? + + \question Create an 8 bit integer variable \code{x} and assign a + valid numeric value to it. Add \code{300} and re-assign the result + to \code{x}. Which value is now stored in \code{x}? Why? \begin{solution} \code{x = int8(35);\\x = x + 300;\\ disp(x)\\ 127}\\ - Der Datentype int8 kann nur Werte von -128 bis 127 speichern. + The int8 dtype can only store values between -128 and 127. \end{solution} - - \question Erkl\"are die Ausgaben von \code{int8(1024)} und \code{uint8(1024)}. + + \question Explain the output of the follwoing commands: \code{int8(1024)} and \code{uint8(1024)}. \begin{solution} - Der int8 Datentyp kann Werte von -128 bis maximal 127 ablegen. Der - uint8 Typ ist \textit{unsigned}, er speichert Werte zwischen 0 und - 255. + int8 can store values between -128 and 127. uint8 is + \textit{unsigned}, ist stores values between 0 and 255. \end{solution} - \question Typkonvertierung: + \question Typeconversion: \begin{parts} - \part F\"uhre aus: \code{x = 131.333}. Welchen Datentyp hat die - Variable \code{x}? + \part Execute: \code{x = 131.333}. What is the datatype of \code{x}? \begin{solution} - Sie hat den Typ \textit{double}. + \textit{double}. \end{solution} - \part Wandle \code{x} in den speichereffizientesten Integer Datentypen um. + \part Convert \code{x} to the most efficient integer datatype. \begin{solution} - \code{x = uint8(x);}\\Ben\"otigt 8 bit anstelle der 64 bit f\"ur - den double. + \code{x = uint8(x);}\\Needs 8 bit instead of 64 bit for double. \end{solution} - \part Welchen Wert hat nun \code{x} ? + \part What is the value stored in \code{x} after conversion? \begin{solution} 131 \end{solution} \end{parts} - \question Flie{\ss}kommazahlen 1: Endliche Pr\"azision bei Addition + \question Floating point numbers I: Limited precision during additions \begin{parts} - \part Weise der Variablen \code{a} eine Zahl mit Nachkommastellen zu. + \part Create the variable \code{a} and assign an arbitrary floting point number. \begin{solution} \code{a = 3.14;} \end{solution} - \part Eine weitere Variable \code{b} soll den Wert \code{a+0.001} - haben. Was ist das Ergebnis von \code{b-a} ? + \part A second variable \code{b} stores the value \code{a+0.001}. What is the result of \code{b-a} ? \begin{solution} \code{b = a + 0.001;}\\ \code{disp(b - a)\\0.001}\\ - Alles ok, Ergebnis wie erwartet. + All cool, result as expected. \end{solution} - \part Einer dritte Variable \code{c} soll der Wert \code{a+1e-16} - zugewiesen werden. Was ist das Ergebnis von \code{c-a} ? Warum? + \part Create a third variable \code{c} and assign \code{a+1e-16}. What is the result of \code{c-a}? Why? \begin{solution} - Das Ergebnis ist 0! Auch die double Werte haben nur eine endliche - P\"azision in den Nachkommastellen. + Result is 0! Also with doubles there is a limited precision in + the decimal part. \end{solution} - \part Berechne \verb=(2^52 + 1) - 2^52= sowie + \part Calculate \verb=(2^52 + 1) - 2^52= and \verb=(2^53 + 1) - 2^53=. \begin{solution} - Im Ersten Fall ist das Ergebnis = 1, im Zweiten = 0. Bei so - gro{\ss}en Zahlen k\"onnen so kleine Unterschiede nicht mehr - aufgel\"ost werden. + First command results in = 1, in the second case = 0. With such + high numbers, small differences (1!) cannot be resolved. \end{solution} - \part Berechne \code{sqrt(1+1e-16)-1} . Ist das richtig? Warum? + \part Calculate \code{sqrt(1+1e-16)-1}. Is the result correct? Why (not)? \begin{solution} - Die Wurzel von 1 + etwas sollte nicht 1 sein! Das Ergebnis - sollte nicht 0 sein. + Square root of something larger than 1 should not be 1 and thus + the result must not be 0. \end{solution} - \part Vergleiche mit dem Ergebnis beim Addieren einer etwas - gr\"o{\ss}eren Zahl (z.B. 1e-8). + \part Compare wwith the result when adding a slightly largern number (e.g. 1e-8). \begin{solution} - Hier sollte das Ergebnis ungleich 0 sein. + Result is not equal to zero. \end{solution} \end{parts} - \question Flie{\ss}kommazahlen 2: Endliche Pr\"azision bei Multiplikation + \question Floating point numbers II: Limited precision during multiplications. \begin{parts} - \part Weise der Variablen \code{a} die Zahl \code{4/3} zu. - \part Die Variable \code{b} soll den Wert \code{3*(a-1)} erhalten. - \part Welches Ergebnis erwartest du f\"ur \code{b-1} ? + \part Create a variable \code{a} and assign \code{4/3}. + \part Variable \code{b} should contain the value \code{3*(a-1)}. + \part What do you expect for \code{b-1}? \begin{solution} - \code{a = 4/3;}\\ \code{b = 3 * (a-1)}\\ - b sollte nun 1 sein. d.h., \code{b-1} sollte 0 sein. + \code{a = 4/3;}\\ \code{b = 3 * (a-1)}\\ + b should be 1. i.e., \code{b-1} should give 0. \end{solution} - \part Berechne mit matlab \code{b-1} ! + \part Calculate with matlab \code{b-1}! \begin{solution} - \code{disp(b - 1)\\ -2.2204e-16}\\ Aufgrund von Rundungsfehlern - kommt es zu diesem Ergebnis. + \code{disp(b - 1)\\ -2.2204e-16}\\ Due to rounding mistakes. \end{solution} - \part Was sollte \code{sin(pi)} ergeben ? Was sagt matlab? + \part What should be the result of \code{sin(pi)}? What gives matlab? \begin{solution} - Sollte 0 sein, ist es aber nicht. Wie oben, Rundungsfehler - f\"uhren zu diesen Abweichungen. + Should be 0, but it is not. See above, due to rounding errors we + get some deviation. \end{solution} \end{parts} \end{questions} -\end{document} \ No newline at end of file +\end{document} diff --git a/programming/exercises/variables_types_de.tex b/programming/exercises/variables_types_de.tex new file mode 100644 index 0000000..5e8fdb3 --- /dev/null +++ b/programming/exercises/variables_types_de.tex @@ -0,0 +1,246 @@ +\documentclass[12pt,a4paper,pdftex]{exam} + +\usepackage[german]{babel} +\usepackage{natbib} +\usepackage{graphicx} +\usepackage[small]{caption} +\usepackage{sidecap} +\usepackage{pslatex} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{lipsum} +\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 \"Ubung 1}}{{\bfseries\large Variablen und Datentypen}}{{\bfseries\large 18. Oktober, 2016}} +\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{L\"osung:}\par\noindent} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\vspace*{-6.5ex} +\begin{center} + \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[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} + +Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster:\linebreak +``variablen\_datentypen\_\{nachname\}.m'' benannt werden +(z.B. variablen\_datentypen\_mueller.m). + +\begin{questions} + + \question Erzeugen und L\"oschen von Variablen: + \begin{parts} + \part Erzeuge zwei Variablen \code{a}, \code{b} und weise ihnen + unterschiedliche Werte zu. Schlie{\ss}e die Zeilen mit einem + Semikolon ab. Erstelle eine Variable \code{c} die leer ist. + \begin{solution} + \code{a = 1;} \code{b = 2;} \code{c = [];} + \end{solution} + \part Lass die Werte der Variablen ausgeben. + \begin{solution} + \code{disp(a)}; \code{disp(b)}; \code{disp(c)} + \end{solution} + \part Benuzte die Kommandozeile um herauszufinden, welche Variablen + es im Workspace gibt. + \begin{solution} + \code{who} + \end{solution} + \part Benuzte die Kommandozeile um herauszufinden, welche Datentypen sie haben. + \begin{solution} + \code{whos} oder \code{class(a)}, \code{class(b)}, \code{class(c)} + \end{solution} + \part Finde in der Hilfe mehr Information \"uber das \code{clear} Kommando. + \begin{solution} + \code{help clear} + \end{solution} + \part L\"osche eine Variable. + \begin{solution} + \code{clear a} + \end{solution} + \part L\"osche alle \"ubrigen Variablen. + \begin{solution} + \code{clear all} oder einfach \code{clear} + \end{solution} + \end{parts} + + \question Operationen auf Variablen: + \begin{parts} + \part Erstelle die Variablen \code{a} und \code{b} und weise ihnen + beliebige Werte zu. + \begin{solution} + \code{a = 5; b = 3.14;} + \end{solution} + \part Addiere beliebige andere Zahlen zu den Variablen \code{a} und \code{b}. + \begin{solution} + \code{a + 5} \code{b + 7.28} + \end{solution} + \part Addiere die Variablen. + \begin{solution} + \code{a + b} + \end{solution} + \part Mulipliziere die Variablen miteinander. + \begin{solution} + \code{a * b} + \end{solution} + \part \"Andern sich die urspr\"unglichen Werte der Variablen? + \begin{solution} + Nein, die Operationen benutzen die Werte der Variablen. Die + Variablen bleiben unver\"andert. + \end{solution} + \part F\"uhre eine beliebige Berechnungen mit den Variablen aus und + weise die Ergebnisse einer neuen Variable \code{x} zu. + \begin{solution} + \code{x = a * b;} + \end{solution} + \part Weise \code{a} und \code{b} neue Werte zu. Hat sich etwas am + Wert von \code{x} ge\"andert? + \begin{solution} + Nein, der Variablen \code{x} wird ein Wert zugewiesen, der sich + nicht \"andert bis der Variablen ein neuer Wert zugewiesen + wird. Die Variable 'x' speichert das Resultat der Rechnung + \textbf{nicht} die Anweisung. + \end{solution} + \end{parts} + + \question Berechne die Fakult\"at von 5: + \begin{parts} + \part Erzeuge eine Variable \code{x} und weise ihr den Wert 1 zu. + \part Berechne den ersten Schritt (\code{*2}) und weise das Ergebnis \code{x} + zu. + \part Fahre schrittweise fort, bis die Fakult\"at von 5 berechnet ist. \code{x} + sollte nun das Endergebnis enthalten. + \end{parts} + \begin{solution} + \code{x = 1;} \\ \code{x = x * 2;}\\ \code{x = x * 3;} \\ \code{x = x * 4;} \\ \code{x = x * 5;}\\ \code{disp(x)}\\ + \code{ 120} + \end{solution} + + \question Erstelle eine Variable, die einen beliebigen Text enth\"alt. Was + ist ihr Datentyp? + \begin{solution} + \code{x = 'einfacher Text'}\\ \code{class(x)\\ char} + \end{solution} + + \question Was sind die gr\"o{\ss}ten Zahlen, die in den Integer 8, 16, 32 + und 64 bit Datentypen abgelegt werden k\"onnen? + \begin{solution} + \verb+2^8 / 2 - 1+\\ + \verb+2^16 / 2 - 1+\\ + \verb+2^32 / 2 - 1+\\ + \verb+2^64 / 2 - 1+ + \end{solution} + + \question Erstelle eine Variable des 8 Bit Integer Datentyps und weise + ihr einen Wert zu. Addiere \code{300}. Welchen Wert enth\"alt nun die + Variable? Warum? + \begin{solution} + \code{x = int8(35);\\x = x + 300;\\ disp(x)\\ 127}\\ + Der Datentype int8 kann nur Werte von -128 bis 127 speichern. + \end{solution} + + \question Erkl\"are die Ausgaben von \code{int8(1024)} und \code{uint8(1024)}. + \begin{solution} + Der int8 Datentyp kann Werte von -128 bis maximal 127 ablegen. Der + uint8 Typ ist \textit{unsigned}, er speichert Werte zwischen 0 und + 255. + \end{solution} + + \question Typkonvertierung: + \begin{parts} + \part F\"uhre aus: \code{x = 131.333}. Welchen Datentyp hat die + Variable \code{x}? + \begin{solution} + Sie hat den Typ \textit{double}. + \end{solution} + \part Wandle \code{x} in den speichereffizientesten Integer Datentypen um. + \begin{solution} + \code{x = uint8(x);}\\Ben\"otigt 8 bit anstelle der 64 bit f\"ur + den double. + \end{solution} + \part Welchen Wert hat nun \code{x} ? + \begin{solution} + 131 + \end{solution} + \end{parts} + + \question Flie{\ss}kommazahlen 1: Endliche Pr\"azision bei Addition + \begin{parts} + \part Weise der Variablen \code{a} eine Zahl mit Nachkommastellen zu. + \begin{solution} + \code{a = 3.14;} + \end{solution} + \part Eine weitere Variable \code{b} soll den Wert \code{a+0.001} + haben. Was ist das Ergebnis von \code{b-a} ? + \begin{solution} + \code{b = a + 0.001;}\\ \code{disp(b - a)\\0.001}\\ + Alles ok, Ergebnis wie erwartet. + \end{solution} + \part Einer dritte Variable \code{c} soll der Wert \code{a+1e-16} + zugewiesen werden. Was ist das Ergebnis von \code{c-a} ? Warum? + \begin{solution} + Das Ergebnis ist 0! Auch die double Werte haben nur eine endliche + P\"azision in den Nachkommastellen. + \end{solution} + \part Berechne \verb=(2^52 + 1) - 2^52= sowie + \verb=(2^53 + 1) - 2^53=. + \begin{solution} + Im Ersten Fall ist das Ergebnis = 1, im Zweiten = 0. Bei so + gro{\ss}en Zahlen k\"onnen so kleine Unterschiede nicht mehr + aufgel\"ost werden. + \end{solution} + \part Berechne \code{sqrt(1+1e-16)-1} . Ist das richtig? Warum? + \begin{solution} + Die Wurzel von 1 + etwas sollte nicht 1 sein! Das Ergebnis + sollte nicht 0 sein. + \end{solution} + \part Vergleiche mit dem Ergebnis beim Addieren einer etwas + gr\"o{\ss}eren Zahl (z.B. 1e-8). + \begin{solution} + Hier sollte das Ergebnis ungleich 0 sein. + \end{solution} + \end{parts} + + \question Flie{\ss}kommazahlen 2: Endliche Pr\"azision bei Multiplikation + \begin{parts} + \part Weise der Variablen \code{a} die Zahl \code{4/3} zu. + \part Die Variable \code{b} soll den Wert \code{3*(a-1)} erhalten. + \part Welches Ergebnis erwartest du f\"ur \code{b-1} ? + \begin{solution} + \code{a = 4/3;}\\ \code{b = 3 * (a-1)}\\ + b sollte nun 1 sein. d.h., \code{b-1} sollte 0 sein. + \end{solution} + \part Berechne mit matlab \code{b-1} ! + \begin{solution} + \code{disp(b - 1)\\ -2.2204e-16}\\ Aufgrund von Rundungsfehlern + kommt es zu diesem Ergebnis. + \end{solution} + \part Was sollte \code{sin(pi)} ergeben ? Was sagt matlab? + \begin{solution} + Sollte 0 sein, ist es aber nicht. Wie oben, Rundungsfehler + f\"uhren zu diesen Abweichungen. + \end{solution} + \end{parts} + +\end{questions} + +\end{document} \ No newline at end of file diff --git a/programming/exercises/vectors_matrices_de.tex b/programming/exercises/vectors_matrices_de.tex new file mode 100644 index 0000000..16af545 --- /dev/null +++ b/programming/exercises/vectors_matrices_de.tex @@ -0,0 +1,410 @@ +\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 \"Ubung + 2}}{{\bfseries\large Vektoren und Matrizen}}{{\bfseries\large 12. Oktober, 2015}} +\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{L\"osung:}\par\noindent} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\vspace*{-6.5ex} +\begin{center} + \textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[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} + +Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und +Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost +werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files) +im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen +``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig +voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster: +\linebreak ``vektoren\_matrizen\_\{nachname\}.m'' benannt werden +(z.B. vektoren\_matrizen\_mueller.m). + +\begin{questions} + \section*{Vektoren} + \question Erzeuge Vektoren mit folgendem Inhalt: + \begin{parts} + \part Von 1 bis 10 in ganzzahligen Schritten. + \begin{solution} + \code{a = 1:10;} + \end{solution} + \part Von 0 bis 20 in 2er Schritten. + \begin{solution} + \code{a = 0:2:20;} + \end{solution} + \part Mit \textbf{absteigendem} Inhalt von 100 bis 0. + \begin{solution} + \code{a = 100:-1:0;} + \end{solution} + \part In 10 Schritten von 0 bis 1. + \begin{solution} + \code{a = 0:0.1:1;} + \end{solution} + \part In 11 Schritten von 0 bis 1. + \begin{solution} + \code{a = 0:1/11:1;} + \end{solution} + \part In 50 Schritten von 0 bis $2\pi$ ($\pi$ ist als Konstante + \code{pi} in Matlab definiert). + \begin{solution} + \code{a = 0:2*pi/50:2*pi;} + \end{solution} + \end{parts} + + \question Rechnen mit Vektoren: + \begin{parts} + \part Definiere einen Vektor \code{x = [3 2 6 8];} + \part Wie gro{\ss} ist der Vektor? Benutze die Funktionen + \code{size} und \code{length}. Was ist der Unterschied zwischen + den beiden Funktionen? + \begin{solution} + \code{x = [3 2 6 8]; \\ disp(length(x));\\ 4\\ disp(size(x))\\ 1 4} + \end{solution} + \part Wie \"andern sich \code{size} und \code{length} des + Vektors wenn er transponiert wird? + \begin{solution} + L\"ange \"andert sich nicht. R\"uckgabewert von size ist invertiert. + \end{solution} + \part Addiere 5 zu jedem Element von \verb+x+. + \begin{solution} + \code{disp(x + 5)} + \end{solution} + \part Multipliziere jedes Element von \code{x} mit 2; + \begin{solution} + \code{disp(x * 2)} + \end{solution} + \part Definiere einen zweiten Vektor (\verb+y = [4 1 3 5];+). + Stelle sicher, dass \code{x} wieder in seiner urspr\"unglichen + Form ist. + \part Addiere beide Vektoren \code{x + y}. + \begin{solution} + \code{y = [4 1 3 5]; \\disp(x + y)\\7 3 9 13} + \end{solution} + \part Subtrahiere beide Vektoren \code{x - y}. + \begin{solution} + \code{disp(x - y)\\-1 1 3 3} + \end{solution} + \part Multipliziere beide Vektoren \code{x * y}. + \begin{solution} + \code{disp(x * y)\\Error using *. Inner matrix dimension must agree.} + \end{solution} + \part Erkl\"are die Fehlermeldung. + \begin{solution} + * ist der Operator f\"ur die Matrixmultiplikation. Bei dieser + muessen die inneren Dimensionen \"uebereinstimmen.\linebreak + \code{disp(size(x))\\1 4 \\disp(size(y)) \\ 1 4}\\ + (m,n)*(n,o) w\"are ok. + \end{solution} + \part Was m\"usste man machen, damit \code{mtimes} bzw. der + \code{*} Operator funktionieren? + \begin{solution} + y m\"usste transponiert werden: \code{x * y'} + \end{solution} + \part Multipliziere die Vektoren elementweise (\code{x .* y}) + und weise das Ergebnis eine neuen Variablen zu. + \begin{solution} + \code{z = x .* y;} + \end{solution} + \end{parts} + + \question Erzeugen von Vektoren mit Helferfunktionen: + \begin{parts} + \part Erstelle einen 100 Elemente langen Vektor mit der Funktion + \code{ones} (siehe Hilfe). Was macht sie? + \begin{solution} + \code{ones(100,1)} erzeugt einen Vektor bei dem alle Elemente mit 1 gef\"ullt sind. + \end{solution} + \part Erstelle einen 100 Elemente langen Vektor mit der Funktion + \code{zeros}. Was macht diese? + \begin{solution} + \code{zeros(100,1)} erzeugt einen Vektor bei dem alle Elemente mit 0 gef\"ullt sind. + \end{solution} + \part Erstelle einen 100 Elemente langen Vektor in dem jedes + Element den Wert 4.5 hat. + \begin{solution} + \code{ones(100,1) * 4.5} + \end{solution} + \part Erzeuge einen Vektor mit 100 Zufallszahlen (\code{rand}, + siehe Hilfe). + \begin{solution} + \code{x = rand(100,1)} + \end{solution} + \part Erzeuge einen Vektor mit 100 Werten zwischen 0 und 1 + mithilfe der Funktion \code{linspace}. + \begin{solution} + \code{x = linspace(0,1,100)} + \end{solution} + \end{parts} + + \question Indizieren in Vektoren: + \begin{parts} + \part Erzeuge einen Vektor mit 100 Elementen (0 - 100). + \begin{solution} + \code{x = linspace(0,100,100);} + \end{solution} + \part Gib jeweils den ersten, den letzten, den 5., 24. und den + vorletzten Wert aus. + \begin{solution} + \code{disp(x(1))\\ disp(x(end))\\ disp(x(5))\\ disp(x(24))\\ disp(x(end-1))} + \end{solution} + \part Gib die ersten 10 Werte aus. + \begin{solution} + \code{x(1:10)} + \end{solution} + \part Gib die letzten 10 Werte aus. + \begin{solution} + \code{disp(x(end-9:end))} + \end{solution} + \part Versuche den Wert an der Stelle 0 auszugeben. + \begin{solution} + \code{x(0)\\ Subscript indices must either be real positive integers or logicals.} + \end{solution} + \part Versuche den Wert an der Stelle 110 auszugeben. + \begin{solution} + \code{x(110)\\ Index exceeds matrix dimensions.} + \end{solution} + \part Gib die Werte an den Stellen 3, 15, und 42 zusammen als + Vektor aus. + \begin{solution} + \code{disp(x([3 15 42]))} + \end{solution} + \part Gib 10 zuf\"allig ausgew\"ahlte Werte aus (benutze + \verb+randi+ um die Indizes zu erstellen). + \begin{solution} + \code{x(randi(100,10,1))} + \end{solution} + \end{parts} + + \question Erzeuge eine Variable und speichere etwas Text in ihr, + so dass mindestens 2 Worte vorhanden sind. (z.B. \code{x = 'some + text'}). Benutze die Indizierung um die W\"orter einzeln + auszugeben. + \begin{solution} + \code{x = 'some text'; \\ disp(x(1:4))\\disp(x(6:end))} + \end{solution} + + + \newpage + \section*{Matrizen} + + \question Erstelle folgende Matrix + \[ A = \left( \begin{array}{ccc} 7 & 3 & 5 \\ 1 & 8 & 3 \\ 8 & 6 & + 4 \end{array} \right) \] + \begin{parts} + \part Benutze die Funktion \code{size} um die Gr\"o{\ss}e vpm \code{A} anzeeigen zu lassen. + \begin{solution} + \code{x = [7 3 5; 1 8 3; 8 6 4];\\disp(size(x))} + \end{solution} + \part Finde heraus, wie man \code{size} aufruft um nur die L\"ange entlang einer einzelnen Dimension auszugeben. Gib einzeln die L\"angen beider Dimensionen aus. + \begin{solution} + \code{disp(size(x, 1))}\\\code{disp(size(x, 2))} + \end{solution} + \part Gib das Element in der 3. Zeile und 2. Spalte aus. + \begin{solution} + \code{x(3,2)} + \end{solution} + \part Gib jeweils alle Elemente der 1., 2. und 3. Zeile aus. + \begin{solution} + \code{disp(x([1 2 3],:));} + \end{solution} + \part Gib jeweils alle Elemente der 1., 2., und 3. Spalte aus. + \begin{solution} + \code{disp(x(:, 1))\\ disp(x(:, 2))\\ disp(x(:, 3))} + \end{solution} + \part Erh\"ohe das Element in der 2. Zeile und 3. Spalte um Eins. + \begin{solution} + \code{x(2,3) = x(2,3) + 1;} + \end{solution} + \part Ziehe von allen Elementen der 1. Zeile 5 ab. + \begin{solution} + \code{x(1,:) = x(1,:) - 5;} + \end{solution} + \part Multipliziere alle Elementen der 3. Spalte mit 2. + \begin{solution} + \code{x(:,3) = x(:,3) * 2;} + \end{solution} + \end{parts} + + \question Erstelle eine $5 \times 5$ Matrix \code{M} die + Zufallszahlen enth\"alt (nutze die MATLAB Funktion + \verb+randn()+. Benutze die Hilfe: Was macht die Funktion?). + \begin{parts} + \part Gib das Element in der 2. Zeile und 3. Spalte aus. + \begin{solution} + \code{M = randn(5, 5);} + \code{disp(M(2,3))} + \end{solution} + + \part Gib jeweils alle Elemente der 1., 3. und letzten Zeile aus. + \begin{solution} + \code{disp(M(1,:)) \\ disp(M(3,:))\\ disp(M(size(M,1), :))} + \end{solution} + + \part Gib jeweils alle Elemente der 2. und 4. Spalte aus. + \begin{solution} + \code{disp(M(:,2))\\ disp(M(:,4))} + \end{solution} + + \part Greife mit einem einzigen Kommando auf die Elemente jeder + zweiten Spalte zu und speichere die Daten in einer neuen Variable. + \begin{solution} + \code{y = M(:, [2:2:size(M,2)])} + \end{solution} + + \part Berechne jeweils den Mittelwert der 1., 3. und 5. Zeile + (Funktion \code{mean}, siehe Hilfe). + \begin{solution} + \code{mean(M([1 3 5],:), 2)} + \end{solution} + + \part Berechne die Summe aller Werte der 2. und 4. Spalte + (Funktion \code{sum}, siehe Hilfe). + \begin{solution} + \code{sum(M(:, [2 4]), 1)} + \end{solution} + + \part Berechne die Summe aller Elemente der Matrize. + \begin{solution} + \code{sum(M(:))} + \end{solution} + + \part Ersetze die Elemente der 2. Zeile mit denen der 4. + \begin{solution} + \code{M(2,:) = M(4,:)} + \end{solution} + + \part F\"uhre folgendes Kommando aus: \code{M(1:2,1) = [1, 2, + 3]}. Was k\"onnte die Absicht dieses Codes gewesen sein? Was + bedeutet die Fehlermeldung? + \begin{solution} + \code{M(1:2,1) = [1, 2,3];\\ Subscripted assignment dimension + mismatch.} \\ Der einzuf\"ugende Vektor hat 3 Elemente, die + Auswahl von M in die geschrieben werden soll hat nur die + Gr\"o{\ss}e 2; + \end{solution} + \end{parts} + + \question Matrizen k\"onnen neben der ``normalen'' + \textit{subscript} Indizierung auch \textit{linear} indiziert werden + (siehe Hilfe \"uber Indexing oder Funktionen \verb+sub2ind+ oder + \verb+ind2sub+). + \begin{parts} + \part Erstelle eine 2-D Matrix mit Zufallszahlen mit der Dimensionalit\"at + \verb+[10,10]+. + \begin{solution} + \code{x = randn(10, 10)} + \end{solution} + + \part Wie viele Werte enth\"alt sie? + \begin{solution} + \code{disp(numel(x))} + \end{solution} + + \part Benutze das lineare Indizieren um 50 zuf\"allige Werte + auszuw\"ahlen. + \begin{solution} + \code{x(randi(100, 50, 1)])} + \end{solution} + + \part Wo liegt der Vorteil gegen\"uber der \textit{subscript} + Indizierung? + \begin{solution} + Die Matrize ist 2-dimensional. Wenn mit dem subscript index + zugegriffen werden soll, dann muss auf die Dimensionen + einzeln geachtet werden. Mit dem linearen Indexieren kann einfach + einen Vektor mit n Indices benutzt werden. Wenn es auch noch eine + eindeutige (ohne doppelte) Auswahl sein soll, dann muss bei + 2-D viel komplexer kontrollieren. + \end{solution} + \part Berechne die Summe aller Werte mit einem Funktionsaufruf.. + \begin{solution} + \code{sum(x(:))} oder \code{sum(sum(x))} + \end{solution} + + \end{parts} + + \question Erstelle folgende Variablen \verb+x = [1 5 9]+ and + \verb+y = [7 1 5]+ und \verb+M = [3 1 6; 5 2 7]+. Welche der + folgenden Operationen funktionieren? Wenn nicht, warum funktionieren + sie nicht? Teste Deine Vorhersagen. + \begin{parts} + \part \code{x + y} + \begin{solution} + Funktioniert! + \end{solution} + + \part \code{x * M} + \begin{solution} + Matrixmultiplikation Funktioniert nicht! Inner dimensions must agree! + \end{solution} + + \part \code{x + y'} + \begin{solution} + Funktioniert nicht! Die Dimensionalit\"aten passen nicht. + \end{solution} + + \part \code{M - [x y]} + \begin{solution} + Funktioniert nicht! \code{[x y] ist ein Zeilenvektor der L\"ange + 6, M ist eine Martix.} + \end{solution} + + \part \code{[x; y]} + \begin{solution} + Funktioniert! Gr\"o{\ss}e: 2 3 + \end{solution} + + \part \code{M - [x; y]} + \begin{solution} + Funktioniert! + \end{solution} + \end{parts} + + \question Erstelle eine 3-D Matrix aus drei 2-D Matrizen. Benutze + die \verb+cat()+ Funktion f\"ur diesen Zweck (schaue in der Hilfe + nach, wie sie benutzt wird). + \begin{parts} + \part Gib alle Elemente des ersten ``Blattes'' aus (Index 1 der 3. Dimension). + \begin{solution} + \code{x = randn(5,5); \\y = randn(5, 5);\\ z = cat(3, x, y);\\disp(z(:,:,1))} + \end{solution} + \end{parts} + + \question Erzeuge eine $5 \times 5 \times 5$ Matrix die mit + ganzzahligen, gleichverteilten Zufallszahlen zwischen 0 und 100 + gef\"ullt ist. + \begin{parts} + \part Berechne den Mittelwert aller Bl\"atter dieser Matrix + (benutze \verb+mean()+, siehe Hilfe). + \begin{solution} + \code{x = round(rand(5,5,5) .* 100);\\ Disp(mean(mean(x(:,:,1))))\\ disp(mean(mean(x(:,:,2)))) \\ disp(mean(mean(x(:,:,3))))} + \end{solution} + \end{parts} + \end{questions} + +\end{document} diff --git a/programming/lecture/programming-chapter.tex b/programming/lecture/programming-chapter.tex index 3c29691..6d3ed40 100644 --- a/programming/lecture/programming-chapter.tex +++ b/programming/lecture/programming-chapter.tex @@ -28,7 +28,11 @@ \item Random-walk behutsam mit einer Schleife, dann zwei Schleifen. Plus Bildchen. \item Random-Walk with drift is model for decision making! See resoures/GoldShadlen2007 paper, Figure 2. Das wird auch in Systems Neurosciene \texttt{9 - Kognitive Kontrolle II.pdf} behandelt. \item Doppelte for-Schleife -\item File output and input (load, save, fprintf, scanf) (extra chapter?) +\item File handling: (extra chapter?) + \begin{itemize} + \item output and input (load, save, fprintf, scanf) + \item dir() function + \end{itemize} \item help() und doc() \item A box about sampling of contiunous data. \item A box about foo and bar? diff --git a/programming/lecture/programming.tex b/programming/lecture/programming.tex index 2a2126f..a6cebd5 100644 --- a/programming/lecture/programming.tex +++ b/programming/lecture/programming.tex @@ -1009,6 +1009,60 @@ segment of data of a certain time span (the stimulus was on, \end{itemize} \end{exercise} +\begin{ibox}[ht]{\label{whenscriptsbox}Advanced data types} + Thoughout this script and the exercises we will limit ourselves to + the basic data types introduced above (int, double, char, scalars, + vectors, matrices and strings). There are, however, \matlab{}- + specific advanced data structures that make life easier (mostly). We + will introduce them breifly here and refer to the \matlab{} help for + further information. \textbf{Note: Some of these data types are + more recent additions to the matlab language. One should consider + this if downward compatibility is desired/needed.} + + \textbf{Structures} Arrays of named fields that each can contain + arbitrary data types. \codeterm{Structures} can have sub-structures + and thus can build a trees. Structures are often used to combine + data and mtadata in a single variable. + + \textbf{Cell arrays} Arrays of variables that contain different + types. Unlike structures, the entries of a \codeterm{Cell array} are + not named. Indexing in \codeterm{Cell arrays} requires a special + operator the \code{\{\}}. \matlab{} uses \codeterm{Cell arrays} for + example when strings of different lengths should be stored in the + same variable: \varcode{months = \{'Januar', 'February', 'March', + 'April', 'May', 'Jun'\};}. Note the curly braces that are used to + create the array and are also used for indexing. + + \textbf{Tables} Tabular structure that allows to have columns of + varying type combined with a header (much like a spreadsheet). + + \textbf{Timetables} Array of values that are associated with a + timestamp. For example one can store measurements, that are made in + irregular intervals togehter with the measurement time in a single + variable. Without the \codeterm{Timetable} data type at least two + variables (one storing the time, the other the measurement) would be + required. \codeterm{Timetables} offer specific convenience functions + to work with timestamps. + + \textbf{Maps} In a \codeterm{map} a \codeterm{value} is associated + with an arbitrary \codeterm{key}. The \codeterm{key} is not + restricted to be an integer but can be almost anything. Maps are an + alternative to structures with the additional advantage that the key + can be used during indexing: \varcode{my\_map('key')}. + + \textbf{Categorical arrays} are used to stored values that come from + a limited set of values, e.g. Months. Such categories can then be + used for filter operations. \codeterm{Categorical arrays} are often + used in conjunctions with \codeterm{Tables}. + \begin{lstlisting}[caption={Using Categorical arrays}, label=categoricallisting] +>> months = categorical({'Jan', 'Feb', 'Jan', 'Dec'}); +>> events = [10, 2, 18, 20 ]; +>> events(months == 'Jan') +ans = + 10 18 + \end{lstlisting} + +\end{ibox} \section{Control flow}\label{controlstructsec} diff --git a/projects/Makefile b/projects/Makefile index d582c40..155aa15 100644 --- a/projects/Makefile +++ b/projects/Makefile @@ -1,9 +1,15 @@ -all: - for d in `ls -d project_*/`; do \ - echo "Processing $$d" ; \ - a=$$(echo $$d*.tex) ; \ - rm $${a%.tex}.zip ; \ - cd $$d; $(MAKE) zip ; cd .. ; \ +all: projects evalutation + +evaluation: evaluation.pdf +evaluation.pdf: evaluation.tex + pdflatex $< + +projects: + for d in `ls -d project_*`; do \ + if test "x$$d" != "xproject_template"; then \ + echo "Processing $$d" ; \ + cd $$d; $(MAKE) zip ; cd .. ; \ + fi \ done mv project_*/*zip . @@ -11,8 +17,10 @@ all: clean: for d in `ls -d project_*/`; do \ echo "Cleaning up $$d" ; \ - cd $$d; $(MAKE) clean ; cd .. ; \ + $(MAKE) -C $$d clean ; \ done + rm -f *~ + rm -f evaluation.aux evaluation.log rm -f *.zip rm -rf auto diff --git a/projects/disclaimer.tex b/projects/disclaimer.tex deleted file mode 100644 index 7d0d834..0000000 --- a/projects/disclaimer.tex +++ /dev/null @@ -1,44 +0,0 @@ - \fbox{\parbox{0.985\linewidth}{ \small - - {\bf Evaluation criteria:} - - Each project has three elements that are graded: (i) the code, - (ii) the slides/figures, and (iii) the presentation. - - \vspace{1ex} - - The {\bf code} and the {\bf presentation} should be uploaded to - ILIAS at latest on Thursday, February 9th, 12:59h. We will - store all presentations on one computer to allow fast - transitions between talks. The presentations start on Thursday, - February 9th at 1:00h c.t.. Please hand in your presentation as - a pdf file. Bundle everything (the pdf, the code, and the data) - into a {\em single} zip-file. - - \vspace{1ex} - - The {\bf code} should be executable without any further - adjustments from our side. A single \texttt{main.m} script should - coordinate the analysis by calling functions and sub-scripts and - should produce the {\em same} figures that you use in your - slides. The code should be properly commented and comprehensible - by a third person (use proper and consistent variable and - function names). - - \vspace{1ex} - - \textbf{Please write your name and matriculation number as a - comment at the top of the \texttt{main.m} script.} - - \vspace{1ex} - - The {\bf presentation} should be {\em at most} 10min long and be - held in English. In the presentation you should (i) briefly - describe the problem, (ii) present figures introducing, showing, - and discussing your results, and (iii) explain how you solved - the problem algorithmically (don't show your entire code). All - data-related figures you show in the presentation should be - produced by your program. It is always a good idea to illustrate - the problem with basic plots of the raw-data. Make sure the axis - labels are large enough! - }} diff --git a/projects/evaluation.tex b/projects/evaluation.tex new file mode 100644 index 0000000..00d2061 --- /dev/null +++ b/projects/evaluation.tex @@ -0,0 +1,44 @@ +\documentclass[12pt,a4paper]{article} + +\usepackage[ngerman]{babel} +\usepackage{pslatex} + +%%%%% page style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage[left=10mm,right=10mm,top=10mm,bottom=10mm,headsep=0ex,headheight=0ex,footskip=0ex]{geometry} +\pagestyle{empty} + +\newcounter{studentnum} +\newcommand{\num}{\rule{0pt}{5.8ex}{\stepcounter{studentnum}\small \arabic{studentnum}}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} + +\sffamily +\section*{Scientific computing WS16/17} + +\begin{tabular}{|p{0.15\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|p{0.07\textwidth}|} +\hline +Name & \multicolumn{5}{l|}{Code} & \multicolumn{3}{l|}{Functions} & Figures \\ + & runs & docu & variable function script names & style & extras & NOT \newline used as scripts & docu & sep. \newline algo./ plot & saved \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline + \num & & & & & & & & & \\ \hline +\end{tabular} + +\end{document} diff --git a/projects/header.tex b/projects/header.tex new file mode 100644 index 0000000..6b19320 --- /dev/null +++ b/projects/header.tex @@ -0,0 +1,56 @@ +\usepackage{pslatex} +\usepackage[mediumspace,mediumqspace,squaren]{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} +\header{{\bfseries\large Scientific Computing}}{{\bfseries\large Project: \ptitle}}{{\bfseries\large Januar 24th, 2017}} +\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}{\vfill\hspace*{\fill}$\rightarrow$\newpage} + +%%%%% new commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\qt}[1]{\textbf{#1}\\} +\newcommand{\code}[1]{\texttt{#1}} + diff --git a/projects/instructions.tex b/projects/instructions.tex new file mode 100644 index 0000000..4e0b1cf --- /dev/null +++ b/projects/instructions.tex @@ -0,0 +1,59 @@ +\setlength{\fboxsep}{2ex} +\fbox{\parbox{1\linewidth}{\small + + {\bf Evaluation criteria:} + + Each project has three elements that are graded: (i) the code, + (ii) the slides/figures, and (iii) the presentation. + + \vspace{1ex} + {\bf Dates:} + + The {\bf code} and the {\bf presentation} should be uploaded to + ILIAS at latest on Thursday, February 9th, 12:59h. We will + store all presentations on one computer to allow fast + transitions between talks. The presentations start on Thursday, + February 9th at 1:00h c.t.. + + \vspace{1ex} + {\bf Files:} + + Please hand in your presentation as a pdf file. Bundle + everything (the pdf, the code, and the data) into a {\em single} + zip-file. + + \vspace{1ex} + {\bf Code:} + + The {\bf code} should be executable without any further + adjustments from our side. A single \texttt{main.m} script + should coordinate the analysis by calling functions and + sub-scripts and should produce the {\em same} figures + (\texttt{saveas()}-function, pdf or png format) that you use in + your slides. The code should be properly commented and + comprehensible by a third person (use proper and consistent + variable and function names). + % Hint: make the zip file you want to upload, unpack it + % somewhere else and check if your main script is running. + + \vspace{1ex} + + \emph{Please write your name and matriculation number as a + comment at the top of the \texttt{main.m} script.} + + + \vspace{1ex} + {\bf Presentation:} + + The {\bf presentation} should be {\em at most} 10min long and be + held in English. In the presentation you should (i) briefly + describe the problem, (ii) present figures introducing, showing, + and discussing your results, and (iii) explain how you solved + the problem algorithmically (don't show your entire code). All + data-related figures you show in the presentation should be + produced by your program --- no editing or labeling by + PowerPoint or other software. It is always a good idea to + illustrate the problem with basic plots of the raw-data. Make + sure the axis labels are large enough! + +}} diff --git a/projects/project.mk b/projects/project.mk new file mode 100644 index 0000000..2f8d3b9 --- /dev/null +++ b/projects/project.mk @@ -0,0 +1,25 @@ +BASENAME=$(subst project_,,$(notdir $(CURDIR))) + +latex: + pdflatex $(BASENAME).tex + pdflatex $(BASENAME).tex + + +pdf: $(BASENAME).pdf + +$(BASENAME).pdf : $(BASENAME).tex ../header.tex ../instructions.tex + pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true + + +watch : + while true; do ! make -q pdf && make pdf; sleep 0.5; done + +clean: + rm -f *~ code/*~ solution/*~ data/*~ + rm -rf *.log *.aux *.out auto + rm -f `basename *.tex .tex`.pdf + rm -f *.zip + +zip: latex + rm -f zip $(BASENAME).zip + zip $(BASENAME).zip *.pdf *.m data/* $(ZIPFILES) diff --git a/projects/project_adaptation_fit/Makefile b/projects/project_adaptation_fit/Makefile index 437b664..a7b3726 100644 --- a/projects/project_adaptation_fit/Makefile +++ b/projects/project_adaptation_fit/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat data/*.mat +include ../project.mk diff --git a/projects/project_adaptation_fit/adaptation_fit.tex b/projects/project_adaptation_fit/adaptation_fit.tex index 715deed..13ea510 100644 --- a/projects/project_adaptation_fit/adaptation_fit.tex +++ b/projects/project_adaptation_fit/adaptation_fit.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Adaptation time-constant} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Estimating the adaptation time-constant.} diff --git a/projects/project_eod/Makefile b/projects/project_eod/Makefile index 2574730..a7b3726 100644 --- a/projects/project_eod/Makefile +++ b/projects/project_eod/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf data/*.mat +include ../project.mk diff --git a/projects/project_eod/eod.tex b/projects/project_eod/eod.tex index c0b6e3d..647a756 100644 --- a/projects/project_eod/eod.tex +++ b/projects/project_eod/eod.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{EOD waveform} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_eod/solution/fit_eod.py b/projects/project_eod/solution/fit_eod.py new file mode 100644 index 0000000..3af725e --- /dev/null +++ b/projects/project_eod/solution/fit_eod.py @@ -0,0 +1,80 @@ +import matplotlib.pyplot as plt +import numpy as np +from IPython import embed +import scipy.io as scio + +def load_data(filename): + data = scio.loadmat(filename) + t = data['t'] + eod = data['eod'] + return t[0], eod[0] + + +def eod_model(p, t): + b_0 = p[0] + omega_0 = p[1] + + params = p[2:] + n = len(params)/2 + eod = np.zeros(t.shape) + for i in range(n): + eod += params[i*2] * np.sin(2 * np.pi * t * (i+1) * omega_0 + params[i*2+1]) + eod += b_0 + return eod + + +def fit_error(p, t, y): + y_dash = eod_model(p,t) + err = np.mean((y - y_dash)**2) + return err + + +def gradient(p, t, y, scale=None): + if scale is None: + scale = np.ones(len(p)) + grad = np.zeros(len(p)) + h = 0.002 + for i in range(len(p)): + p_temp = list(p) + p_temp[i] = p[i] + scale[i] * h + grad[i] = (fit_error(p_temp, t, y) - fit_error(p, t, y)) / h + return grad + + +def gradient_descent(t, y): + count = 80 + b_0 = np.mean(y) + omega_0 = 650 + params = [b_0, omega_0, np.min(y) + np.max(y), np.pi/2, (np.min(y) + np.max(y))/2, np.pi/3, (np.min(y) + np.max(y))/4, np.pi/4, (np.min(y) + np.max(y))/5, np.pi] + scale = np.ones(len(params)) + scale[1] = 1000 + eps = 0.01 + grad = None + errors = [] + plt.axis([0, t[count], -3, 3.5]) + plt.ion() + plt.plot(t[:count], y[:count]) + l = None + while (grad is None) or (np.linalg.norm(grad) > 0.01): + errors.append(fit_error(params, t[:count], y[:count])) + + grad = gradient(params, t[:count], y[:count]) + params -= eps * scale * grad + if l is None: + l = plt.plot(t[:count], eod_model(params, t[:count])) + else: + l[0].set_data(t[:count], eod_model(params, t[:count])) + plt.title("norm: %.2f, freq: %.2f" % (np.linalg.norm(grad), params[1])) + plt.pause(0.005) + embed() + exit() + + + +if __name__ == "__main__": + datafile = '../data/EOD_data.mat' + t, eod = load_data(datafile) + # eod = eod_model([0.0, 600, 1.0, 0.0], t[:100]) + gradient_descent(t, eod) + embed() + exit() diff --git a/projects/project_eyetracker/Makefile b/projects/project_eyetracker/Makefile index 064bfc3..a7b3726 100644 --- a/projects/project_eyetracker/Makefile +++ b/projects/project_eyetracker/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf data/*.mat +include ../project.mk diff --git a/projects/project_eyetracker/eyetracker.tex b/projects/project_eyetracker/eyetracker.tex index 447d6b0..9ad9afb 100644 --- a/projects/project_eyetracker/eyetracker.tex +++ b/projects/project_eyetracker/eyetracker.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Eye tracker} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Analysis of eye trajectories.} diff --git a/projects/project_fano_slope/Makefile b/projects/project_fano_slope/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_fano_slope/Makefile +++ b/projects/project_fano_slope/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_fano_slope/fano_slope.tex b/projects/project_fano_slope/fano_slope.tex index 477b770..a1f6c89 100644 --- a/projects/project_fano_slope/fano_slope.tex +++ b/projects/project_fano_slope/fano_slope.tex @@ -1,52 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014 - -- 11/05/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Stimulus discrimination} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_fano_slope/lifboltzmannspikes.m b/projects/project_fano_slope/lifboltzmannspikes.m index 85ea63e..6da50d8 100644 --- a/projects/project_fano_slope/lifboltzmannspikes.m +++ b/projects/project_fano_slope/lifboltzmannspikes.m @@ -20,7 +20,7 @@ function spikes = lifboltzmannspikes(trials, input, tmax, gain) for k=1:trials times = []; j = 1; - v = vreset; + v = vreset + (vthresh - vreset) * rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:n v = v + (- v + noise(i) + inb)*dt/tau; diff --git a/projects/project_fano_slope/solution/fanoslope.m b/projects/project_fano_slope/solution/fanoslope.m index d2bd643..cd0d27d 100644 --- a/projects/project_fano_slope/solution/fanoslope.m +++ b/projects/project_fano_slope/solution/fanoslope.m @@ -76,7 +76,8 @@ plot(false2s, true1s); T = 0.1; gains = 0.01:0.01:1.0; cmax = 100; -ds = zeros(length(gains), 1); +dstt = zeros(length(gains), 1); +dsff = zeros(length(gains), 1); for k = 1:length(gains) gain = gains(k); spikes1 = lifboltzmannspikes(trials, I1, tmax, gain); @@ -84,9 +85,11 @@ for k = 1:length(gains) [c1, b1] = counthist(spikes1, 0.0, tmax, T, cmax); [c2, b2] = counthist(spikes2, 0.0, tmax, T, cmax); [d, thresholds, true1s, false1s, true2s, false2s, pratio] = discriminability(spikes1, spikes2, tmax, T, cmax); - ds(k) = d; + dstt(k) = d; + dsff(k) = min(false1s + false2s); end figure() -plot(gains, ds) - - +plot(gains, dstt); +hold on; +plot(gains, dsff); +hold off; diff --git a/projects/project_fano_slope/solution/lifboltzmannspikes.m b/projects/project_fano_slope/solution/lifboltzmannspikes.m index 85ea63e..6da50d8 100644 --- a/projects/project_fano_slope/solution/lifboltzmannspikes.m +++ b/projects/project_fano_slope/solution/lifboltzmannspikes.m @@ -20,7 +20,7 @@ function spikes = lifboltzmannspikes(trials, input, tmax, gain) for k=1:trials times = []; j = 1; - v = vreset; + v = vreset + (vthresh - vreset) * rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:n v = v + (- v + noise(i) + inb)*dt/tau; diff --git a/projects/project_fano_test/Makefile b/projects/project_fano_test/Makefile index dad25ce..a7b3726 100644 --- a/projects/project_fano_test/Makefile +++ b/projects/project_fano_test/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat +include ../project.mk diff --git a/projects/project_fano_test/fano.mat b/projects/project_fano_test/data/fano.mat similarity index 100% rename from projects/project_fano_test/fano.mat rename to projects/project_fano_test/data/fano.mat diff --git a/projects/project_fano_test/fano.tex b/projects/project_fano_test/fano_test.tex similarity index 60% rename from projects/project_fano_test/fano.tex rename to projects/project_fano_test/fano_test.tex index 4e80405..2e488e2 100644 --- a/projects/project_fano_test/fano.tex +++ b/projects/project_fano_test/fano_test.tex @@ -1,37 +1,16 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Fabian Sinz} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Fano factor test} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} - -%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% +\input{../instructions.tex} +%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \begin{questions} \question The Fano factor $F=\frac{\sigma^2}{\mu}$ relates the variance of a spike count $\sigma^2$ to the mean spike count diff --git a/projects/project_fano_time/Makefile b/projects/project_fano_time/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_fano_time/Makefile +++ b/projects/project_fano_time/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_fano_time/fano_time.tex b/projects/project_fano_time/fano_time.tex index 741916d..e2960af 100644 --- a/projects/project_fano_time/fano_time.tex +++ b/projects/project_fano_time/fano_time.tex @@ -1,52 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014 - -- 11/05/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Stimulus discrimination} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_fano_time/lifspikes.m b/projects/project_fano_time/lifspikes.m index c1bec46..c079742 100644 --- a/projects/project_fano_time/lifspikes.m +++ b/projects/project_fano_time/lifspikes.m @@ -19,7 +19,7 @@ function spikes = lifspikes(trials, input, tmax) for k=1:trials times = []; j = 1; - v = vreset + (vthresh-vreset)*rand(1); + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:length(noise) v = v + (- v + noise(i) + input)*dt/tau; diff --git a/projects/project_fano_time/solution/lifspikes.m b/projects/project_fano_time/solution/lifspikes.m index c1bec46..c079742 100644 --- a/projects/project_fano_time/solution/lifspikes.m +++ b/projects/project_fano_time/solution/lifspikes.m @@ -19,7 +19,7 @@ function spikes = lifspikes(trials, input, tmax) for k=1:trials times = []; j = 1; - v = vreset + (vthresh-vreset)*rand(1); + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:length(noise) v = v + (- v + noise(i) + input)*dt/tau; diff --git a/projects/project_input_resistance/Makefile b/projects/project_input_resistance/Makefile index 8c2681a..a7b3726 100644 --- a/projects/project_input_resistance/Makefile +++ b/projects/project_input_resistance/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf data/*.mat +include ../project.mk diff --git a/projects/project_input_resistance/input_resistance.tex b/projects/project_input_resistance/input_resistance.tex index 189aefa..68a3b83 100644 --- a/projects/project_input_resistance/input_resistance.tex +++ b/projects/project_input_resistance/input_resistance.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Cellular properties} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Estimating cellular properties of different cell types.} diff --git a/projects/project_isicorrelations/Makefile b/projects/project_isicorrelations/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_isicorrelations/Makefile +++ b/projects/project_isicorrelations/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_isicorrelations/isicorrelations.tex b/projects/project_isicorrelations/isicorrelations.tex index d54ef58..f9eee80 100644 --- a/projects/project_isicorrelations/isicorrelations.tex +++ b/projects/project_isicorrelations/isicorrelations.tex @@ -1,55 +1,16 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Interspike-intervall correlations} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} -%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \begin{questions} \question You are recording the activity of a neuron in response to constant stimuli of intensity $I$ (think of that, for example, diff --git a/projects/project_isicorrelations/lifadaptspikes.m b/projects/project_isicorrelations/lifadaptspikes.m index 2ef1874..e2de8fc 100644 --- a/projects/project_isicorrelations/lifadaptspikes.m +++ b/projects/project_isicorrelations/lifadaptspikes.m @@ -32,7 +32,7 @@ function spikes = lifadaptspikes( trials, input, tmaxdt, D, tauadapt, adaptincr for k=1:trials times = []; j = 1; - v = vreset; + v = vreset + (vthresh-vreset)*rand(); a = 0.0; noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt); for i=1:length( noise ) diff --git a/projects/project_isipdffit/Makefile b/projects/project_isipdffit/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_isipdffit/Makefile +++ b/projects/project_isipdffit/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_isipdffit/isipdffit.tex b/projects/project_isipdffit/isipdffit.tex index 4169c81..c6c07cb 100644 --- a/projects/project_isipdffit/isipdffit.tex +++ b/projects/project_isipdffit/isipdffit.tex @@ -1,52 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014 - -- 11/05/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{ISI distributions} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_isipdffit/lifouspikes.m b/projects/project_isipdffit/lifouspikes.m index fc1f5d5..3bff0d0 100644 --- a/projects/project_isipdffit/lifouspikes.m +++ b/projects/project_isipdffit/lifouspikes.m @@ -28,7 +28,7 @@ function spikes = lifouspikes( trials, input, tmaxdt, D, outau ) times = []; j = 1; n = 0.0; - v = vreset; + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt); for i=1:length( noise ) n = n + ( - n + noise(i))*dt/outau; diff --git a/projects/project_isipdffit/pifouspikes.m b/projects/project_isipdffit/pifouspikes.m index b6516cc..f85cfae 100644 --- a/projects/project_isipdffit/pifouspikes.m +++ b/projects/project_isipdffit/pifouspikes.m @@ -28,7 +28,7 @@ function spikes = pifouspikes( trials, input, tmaxdt, D, outau ) times = []; j = 1; n = 0.0; - v = vreset; + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt); for i=1:length( noise ) n = n + ( - n + noise(i))*dt/outau; diff --git a/projects/project_isipdffit/solution/invgauss.m b/projects/project_isipdffit/solution/invgauss.m new file mode 100644 index 0000000..db07626 --- /dev/null +++ b/projects/project_isipdffit/solution/invgauss.m @@ -0,0 +1,11 @@ +function p = invgauss(x, mu, D) + if abs(x) < 1e-8 + p = zeros(size(x)) + else + if x < 0 + x = -x; + end + p = exp(-(x-mu).^2./4.0./D./x./mu./mu)./sqrt(4.*pi.*D.*x.^3.0); + end + p(p<1e-16) = 1e-16; +end diff --git a/projects/project_isipdffit/solution/isipdffit.m b/projects/project_isipdffit/solution/isipdffit.m new file mode 100644 index 0000000..e518161 --- /dev/null +++ b/projects/project_isipdffit/solution/isipdffit.m @@ -0,0 +1,72 @@ +%% check Pig implementation: +mu = 0.01; +D = 1.0; +dx=0.0001; +x = dx:dx:10.0; + +for D = [0.1 1 10 100] + for mu = [0.01 0.03 0.1 .03] + %pig = exp(-(x-mu).^2/4.0/D./x./mu/mu)./sqrt(4*pi*D*x.^3.0); + pig = invgauss(x,mu,D); + P = sum(pig)*dx; + mig = sum(x.*pig)*dx; + qig = sum(x.*x.*pig)*dx; + vig = qig - mig*mig; + dig = 0.5*vig/mig^3; + fprintf('Integral=%.3f\n', P); + fprintf('Average=%.3f = %.3f\n', mig, mu); + %fprintf('Variance=%.3f\n', vig); + fprintf('Diffusion=%.3f = %.3f\n\n', dig, D); + + plot(x, pig) + hold on + plot([mu mu], [0 max(pig)], 'k') + hold off + xmax = 3.0*mu; + if xmax < 0.1 + xmax = 0.1; + end + xlim([0 xmax]) + text(0.6, 0.8, sprintf('D=%.3g', D), 'units', 'normalized') + pause( 1.0 ) + end +end + + +%% fit to data: +trials = 1; +tmax = 100.0; +input = 10.0; % the input I +Dnoise = 1.0; % noise strength +outau = 0.1; % correlation time of the noise in seconds +%for input = [9.5 10.1 11.7 15.9] +% spikes = lifouspikes(trials, input, tmax, Dnoise, outau); +for input = [1.0 2.0 5.0 10.0] + spikes = pifouspikes(trials, input, tmax, Dnoise, outau); + isis = diff(spikes{1}); + mu = mean(isis); + fprintf('mean firing rate = %.0f Hz\n', 1.0/mu) + v = var(isis); + D = 0.5*v/mu^3; + [h,b] = hist(isis, 0:0.001:1); + h = h/sum(h)/(b(2)-b(1)); + bar(b, h); + hold on; + dx=0.0001; + x = dx:dx:max(isis); + pig = exp(-(x-mu).^2/4.0/D./x./mu/mu)./sqrt(4*pi*D*x.^3.0); + plot(x, pig, 'r', 'linewidth', 2); + % mle fit: + phat = mle(isis, 'pdf', @invgauss, 'start', [0.1 0.1] ); + mu = phat(1); + D = phat(2); + pig = exp(-(x-mu).^2/4.0/D./x./mu/mu)./sqrt(4*pi*D*x.^3.0); + plot(x, pig, 'c', 'linewidth', 2); + xlim([0 4.0*mu]) + hold off; + pause( 4.0 ) +end + + + + diff --git a/projects/project_lif/Makefile b/projects/project_lif/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_lif/Makefile +++ b/projects/project_lif/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_lif/lif.tex b/projects/project_lif/lif.tex index a862f6b..077c472 100644 --- a/projects/project_lif/lif.tex +++ b/projects/project_lif/lif.tex @@ -1,53 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } - - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Integrate-and-fire neuron} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% @@ -89,6 +50,9 @@ time = [0.0:dt:tmax]; % t_i and compute $V(t)$ for $t_{max}=50$\,ms. Plot $V(t)$ and compare it to the expected result of $V(t) = \exp(-t/\tau)$. + Vary the time step $\Delta t$ by factors of 10 and discuss + accuracy of numerical solutions. What is a good time step? + Why is $V=0$ the resting potential of this neuron? \part Response of the passive membrane to a step input. diff --git a/projects/project_mutualinfo/Makefile b/projects/project_mutualinfo/Makefile index dad25ce..a7b3726 100644 --- a/projects/project_mutualinfo/Makefile +++ b/projects/project_mutualinfo/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat +include ../project.mk diff --git a/projects/project_mutualinfo/decisions.mat b/projects/project_mutualinfo/data/decisions.mat similarity index 100% rename from projects/project_mutualinfo/decisions.mat rename to projects/project_mutualinfo/data/decisions.mat diff --git a/projects/project_mutualinfo/mutualinfo.tex b/projects/project_mutualinfo/mutualinfo.tex index f8ae91f..f2eef9b 100644 --- a/projects/project_mutualinfo/mutualinfo.tex +++ b/projects/project_mutualinfo/mutualinfo.tex @@ -1,36 +1,16 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014 - -- 11/05/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Mutual information} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} -%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \begin{questions} \question A subject was presented two possible objects for a very brief time ($50$\,ms). The task of the subject was to report which of diff --git a/projects/project_noiseficurves/Makefile b/projects/project_noiseficurves/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_noiseficurves/Makefile +++ b/projects/project_noiseficurves/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_noiseficurves/lifspikes.m b/projects/project_noiseficurves/lifspikes.m index 5c06505..313397f 100644 --- a/projects/project_noiseficurves/lifspikes.m +++ b/projects/project_noiseficurves/lifspikes.m @@ -18,7 +18,7 @@ function spikes = lifspikes(trials, input, tmax, D) for k=1:trials times = []; j = 1; - v = vreset; + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:n v = v + (- v + noise(i) + input)*dt/tau; diff --git a/projects/project_noiseficurves/noiseficurves.tex b/projects/project_noiseficurves/noiseficurves.tex index dd07115..4894466 100644 --- a/projects/project_noiseficurves/noiseficurves.tex +++ b/projects/project_noiseficurves/noiseficurves.tex @@ -1,55 +1,17 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014 - -- 11/05/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions - -%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\usepackage{listings} -\lstset{ - basicstyle=\ttfamily, - numbers=left, - showstringspaces=false, - language=Matlab, - breaklines=true, - breakautoindent=true, - columns=flexible, - frame=single, -% captionpos=t, - xleftmargin=2em, - xrightmargin=1em, -% aboveskip=11pt, - %title=\lstname, -% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext} - } +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Neural tuning and noise} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} -%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% +\section{REPLACE BY SUBTHRESHOLD RESONANCE PROJECT!} \begin{questions} \question You are recording the activity of a neuron in response to constant stimuli of intensity $I$ (think of that, for example, diff --git a/projects/project_noiseficurves/solution/lifspikes.m b/projects/project_noiseficurves/solution/lifspikes.m index 5c06505..313397f 100644 --- a/projects/project_noiseficurves/solution/lifspikes.m +++ b/projects/project_noiseficurves/solution/lifspikes.m @@ -18,7 +18,7 @@ function spikes = lifspikes(trials, input, tmax, D) for k=1:trials times = []; j = 1; - v = vreset; + v = vreset + (vthresh-vreset)*rand(); noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt); for i=1:n v = v + (- v + noise(i) + input)*dt/tau; diff --git a/projects/project_numbers/Makefile b/projects/project_numbers/Makefile index 437b664..a7b3726 100644 --- a/projects/project_numbers/Makefile +++ b/projects/project_numbers/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat data/*.mat +include ../project.mk diff --git a/projects/project_numbers/numbers.tex b/projects/project_numbers/numbers.tex index d2f7d29..47d51b4 100644 --- a/projects/project_numbers/numbers.tex +++ b/projects/project_numbers/numbers.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Number coding} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_onset_fi/Makefile b/projects/project_onset_fi/Makefile index 437b664..a7b3726 100644 --- a/projects/project_onset_fi/Makefile +++ b/projects/project_onset_fi/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat data/*.mat +include ../project.mk diff --git a/projects/project_onset_fi/onset_fi.tex b/projects/project_onset_fi/onset_fi.tex index c3aa982..f8df064 100644 --- a/projects/project_onset_fi/onset_fi.tex +++ b/projects/project_onset_fi/onset_fi.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Onset f-I curve} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Quantifying the responsiveness of a neuron using the F-I curve.} diff --git a/projects/project_pca_natural_images/Makefile b/projects/project_pca_natural_images/Makefile new file mode 100644 index 0000000..a7b3726 --- /dev/null +++ b/projects/project_pca_natural_images/Makefile @@ -0,0 +1,3 @@ +ZIPFILES= + +include ../project.mk diff --git a/projects/project_pca_natural_img/natimg.jpg b/projects/project_pca_natural_images/data/natimg.jpg similarity index 100% rename from projects/project_pca_natural_img/natimg.jpg rename to projects/project_pca_natural_images/data/natimg.jpg diff --git a/projects/project_pca_natural_img/pca_natural_images.tex b/projects/project_pca_natural_images/pca_natural_images.tex old mode 100755 new mode 100644 similarity index 59% rename from projects/project_pca_natural_img/pca_natural_images.tex rename to projects/project_pca_natural_images/pca_natural_images.tex index 85ff72f..0091bd7 --- a/projects/project_pca_natural_img/pca_natural_images.tex +++ b/projects/project_pca_natural_images/pca_natural_images.tex @@ -1,33 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Fabian Sinz} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Image statistics} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_pca_natural_img/Makefile b/projects/project_pca_natural_img/Makefile deleted file mode 100644 index 3da8318..0000000 --- a/projects/project_pca_natural_img/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null - -clean: - rm -rf *.log *.aux *.zip *.out auto *.bbl *.blg - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.jpg diff --git a/projects/project_photoreceptor/Makefile b/projects/project_photoreceptor/Makefile index fd67389..a7b3726 100644 --- a/projects/project_photoreceptor/Makefile +++ b/projects/project_photoreceptor/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat data/*.mat +include ../project.mk diff --git a/projects/project_photoreceptor/photoreceptor.tex b/projects/project_photoreceptor/photoreceptor.tex index 9bcf78d..bebfbb7 100644 --- a/projects/project_photoreceptor/photoreceptor.tex +++ b/projects/project_photoreceptor/photoreceptor.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Photoreceptor activity} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Analysis of insect photoreceptor data.} diff --git a/projects/project_populationvector/Makefile b/projects/project_populationvector/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_populationvector/Makefile +++ b/projects/project_populationvector/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_populationvector/population01.mat b/projects/project_populationvector/data/population01.mat similarity index 100% rename from projects/project_populationvector/population01.mat rename to projects/project_populationvector/data/population01.mat diff --git a/projects/project_populationvector/population02.mat b/projects/project_populationvector/data/population02.mat similarity index 100% rename from projects/project_populationvector/population02.mat rename to projects/project_populationvector/data/population02.mat diff --git a/projects/project_populationvector/population03.mat b/projects/project_populationvector/data/population03.mat similarity index 100% rename from projects/project_populationvector/population03.mat rename to projects/project_populationvector/data/population03.mat diff --git a/projects/project_populationvector/population04.mat b/projects/project_populationvector/data/population04.mat similarity index 100% rename from projects/project_populationvector/population04.mat rename to projects/project_populationvector/data/population04.mat diff --git a/projects/project_populationvector/population05.mat b/projects/project_populationvector/data/population05.mat similarity index 100% rename from projects/project_populationvector/population05.mat rename to projects/project_populationvector/data/population05.mat diff --git a/projects/project_populationvector/population06.mat b/projects/project_populationvector/data/population06.mat similarity index 100% rename from projects/project_populationvector/population06.mat rename to projects/project_populationvector/data/population06.mat diff --git a/projects/project_populationvector/population07.mat b/projects/project_populationvector/data/population07.mat similarity index 100% rename from projects/project_populationvector/population07.mat rename to projects/project_populationvector/data/population07.mat diff --git a/projects/project_populationvector/population08.mat b/projects/project_populationvector/data/population08.mat similarity index 100% rename from projects/project_populationvector/population08.mat rename to projects/project_populationvector/data/population08.mat diff --git a/projects/project_populationvector/population09.mat b/projects/project_populationvector/data/population09.mat similarity index 100% rename from projects/project_populationvector/population09.mat rename to projects/project_populationvector/data/population09.mat diff --git a/projects/project_populationvector/population10.mat b/projects/project_populationvector/data/population10.mat similarity index 100% rename from projects/project_populationvector/population10.mat rename to projects/project_populationvector/data/population10.mat diff --git a/projects/project_populationvector/population11.mat b/projects/project_populationvector/data/population11.mat similarity index 100% rename from projects/project_populationvector/population11.mat rename to projects/project_populationvector/data/population11.mat diff --git a/projects/project_populationvector/population12.mat b/projects/project_populationvector/data/population12.mat similarity index 100% rename from projects/project_populationvector/population12.mat rename to projects/project_populationvector/data/population12.mat diff --git a/projects/project_populationvector/population13.mat b/projects/project_populationvector/data/population13.mat similarity index 100% rename from projects/project_populationvector/population13.mat rename to projects/project_populationvector/data/population13.mat diff --git a/projects/project_populationvector/population14.mat b/projects/project_populationvector/data/population14.mat similarity index 100% rename from projects/project_populationvector/population14.mat rename to projects/project_populationvector/data/population14.mat diff --git a/projects/project_populationvector/population15.mat b/projects/project_populationvector/data/population15.mat similarity index 100% rename from projects/project_populationvector/population15.mat rename to projects/project_populationvector/data/population15.mat diff --git a/projects/project_populationvector/population16.mat b/projects/project_populationvector/data/population16.mat similarity index 100% rename from projects/project_populationvector/population16.mat rename to projects/project_populationvector/data/population16.mat diff --git a/projects/project_populationvector/population17.mat b/projects/project_populationvector/data/population17.mat similarity index 100% rename from projects/project_populationvector/population17.mat rename to projects/project_populationvector/data/population17.mat diff --git a/projects/project_populationvector/population18.mat b/projects/project_populationvector/data/population18.mat similarity index 100% rename from projects/project_populationvector/population18.mat rename to projects/project_populationvector/data/population18.mat diff --git a/projects/project_populationvector/population19.mat b/projects/project_populationvector/data/population19.mat similarity index 100% rename from projects/project_populationvector/population19.mat rename to projects/project_populationvector/data/population19.mat diff --git a/projects/project_populationvector/population20.mat b/projects/project_populationvector/data/population20.mat similarity index 100% rename from projects/project_populationvector/population20.mat rename to projects/project_populationvector/data/population20.mat diff --git a/projects/project_populationvector/population21.mat b/projects/project_populationvector/data/population21.mat similarity index 100% rename from projects/project_populationvector/population21.mat rename to projects/project_populationvector/data/population21.mat diff --git a/projects/project_populationvector/population22.mat b/projects/project_populationvector/data/population22.mat similarity index 100% rename from projects/project_populationvector/population22.mat rename to projects/project_populationvector/data/population22.mat diff --git a/projects/project_populationvector/population23.mat b/projects/project_populationvector/data/population23.mat similarity index 100% rename from projects/project_populationvector/population23.mat rename to projects/project_populationvector/data/population23.mat diff --git a/projects/project_populationvector/population24.mat b/projects/project_populationvector/data/population24.mat similarity index 100% rename from projects/project_populationvector/population24.mat rename to projects/project_populationvector/data/population24.mat diff --git a/projects/project_populationvector/population25.mat b/projects/project_populationvector/data/population25.mat similarity index 100% rename from projects/project_populationvector/population25.mat rename to projects/project_populationvector/data/population25.mat diff --git a/projects/project_populationvector/population26.mat b/projects/project_populationvector/data/population26.mat similarity index 100% rename from projects/project_populationvector/population26.mat rename to projects/project_populationvector/data/population26.mat diff --git a/projects/project_populationvector/population27.mat b/projects/project_populationvector/data/population27.mat similarity index 100% rename from projects/project_populationvector/population27.mat rename to projects/project_populationvector/data/population27.mat diff --git a/projects/project_populationvector/population28.mat b/projects/project_populationvector/data/population28.mat similarity index 100% rename from projects/project_populationvector/population28.mat rename to projects/project_populationvector/data/population28.mat diff --git a/projects/project_populationvector/population29.mat b/projects/project_populationvector/data/population29.mat similarity index 100% rename from projects/project_populationvector/population29.mat rename to projects/project_populationvector/data/population29.mat diff --git a/projects/project_populationvector/population30.mat b/projects/project_populationvector/data/population30.mat similarity index 100% rename from projects/project_populationvector/population30.mat rename to projects/project_populationvector/data/population30.mat diff --git a/projects/project_populationvector/population31.mat b/projects/project_populationvector/data/population31.mat similarity index 100% rename from projects/project_populationvector/population31.mat rename to projects/project_populationvector/data/population31.mat diff --git a/projects/project_populationvector/population32.mat b/projects/project_populationvector/data/population32.mat similarity index 100% rename from projects/project_populationvector/population32.mat rename to projects/project_populationvector/data/population32.mat diff --git a/projects/project_populationvector/population33.mat b/projects/project_populationvector/data/population33.mat similarity index 100% rename from projects/project_populationvector/population33.mat rename to projects/project_populationvector/data/population33.mat diff --git a/projects/project_populationvector/population34.mat b/projects/project_populationvector/data/population34.mat similarity index 100% rename from projects/project_populationvector/population34.mat rename to projects/project_populationvector/data/population34.mat diff --git a/projects/project_populationvector/population35.mat b/projects/project_populationvector/data/population35.mat similarity index 100% rename from projects/project_populationvector/population35.mat rename to projects/project_populationvector/data/population35.mat diff --git a/projects/project_populationvector/population36.mat b/projects/project_populationvector/data/population36.mat similarity index 100% rename from projects/project_populationvector/population36.mat rename to projects/project_populationvector/data/population36.mat diff --git a/projects/project_populationvector/population37.mat b/projects/project_populationvector/data/population37.mat similarity index 100% rename from projects/project_populationvector/population37.mat rename to projects/project_populationvector/data/population37.mat diff --git a/projects/project_populationvector/population38.mat b/projects/project_populationvector/data/population38.mat similarity index 100% rename from projects/project_populationvector/population38.mat rename to projects/project_populationvector/data/population38.mat diff --git a/projects/project_populationvector/population39.mat b/projects/project_populationvector/data/population39.mat similarity index 100% rename from projects/project_populationvector/population39.mat rename to projects/project_populationvector/data/population39.mat diff --git a/projects/project_populationvector/population40.mat b/projects/project_populationvector/data/population40.mat similarity index 100% rename from projects/project_populationvector/population40.mat rename to projects/project_populationvector/data/population40.mat diff --git a/projects/project_populationvector/population41.mat b/projects/project_populationvector/data/population41.mat similarity index 100% rename from projects/project_populationvector/population41.mat rename to projects/project_populationvector/data/population41.mat diff --git a/projects/project_populationvector/population42.mat b/projects/project_populationvector/data/population42.mat similarity index 100% rename from projects/project_populationvector/population42.mat rename to projects/project_populationvector/data/population42.mat diff --git a/projects/project_populationvector/population43.mat b/projects/project_populationvector/data/population43.mat similarity index 100% rename from projects/project_populationvector/population43.mat rename to projects/project_populationvector/data/population43.mat diff --git a/projects/project_populationvector/population44.mat b/projects/project_populationvector/data/population44.mat similarity index 100% rename from projects/project_populationvector/population44.mat rename to projects/project_populationvector/data/population44.mat diff --git a/projects/project_populationvector/population45.mat b/projects/project_populationvector/data/population45.mat similarity index 100% rename from projects/project_populationvector/population45.mat rename to projects/project_populationvector/data/population45.mat diff --git a/projects/project_populationvector/population46.mat b/projects/project_populationvector/data/population46.mat similarity index 100% rename from projects/project_populationvector/population46.mat rename to projects/project_populationvector/data/population46.mat diff --git a/projects/project_populationvector/population47.mat b/projects/project_populationvector/data/population47.mat similarity index 100% rename from projects/project_populationvector/population47.mat rename to projects/project_populationvector/data/population47.mat diff --git a/projects/project_populationvector/population48.mat b/projects/project_populationvector/data/population48.mat similarity index 100% rename from projects/project_populationvector/population48.mat rename to projects/project_populationvector/data/population48.mat diff --git a/projects/project_populationvector/population49.mat b/projects/project_populationvector/data/population49.mat similarity index 100% rename from projects/project_populationvector/population49.mat rename to projects/project_populationvector/data/population49.mat diff --git a/projects/project_populationvector/population50.mat b/projects/project_populationvector/data/population50.mat similarity index 100% rename from projects/project_populationvector/population50.mat rename to projects/project_populationvector/data/population50.mat diff --git a/projects/project_populationvector/unit1.mat b/projects/project_populationvector/data/unit1.mat similarity index 100% rename from projects/project_populationvector/unit1.mat rename to projects/project_populationvector/data/unit1.mat diff --git a/projects/project_populationvector/unit2.mat b/projects/project_populationvector/data/unit2.mat similarity index 100% rename from projects/project_populationvector/unit2.mat rename to projects/project_populationvector/data/unit2.mat diff --git a/projects/project_populationvector/unit3.mat b/projects/project_populationvector/data/unit3.mat similarity index 100% rename from projects/project_populationvector/unit3.mat rename to projects/project_populationvector/data/unit3.mat diff --git a/projects/project_populationvector/unit4.mat b/projects/project_populationvector/data/unit4.mat similarity index 100% rename from projects/project_populationvector/unit4.mat rename to projects/project_populationvector/data/unit4.mat diff --git a/projects/project_populationvector/unit5.mat b/projects/project_populationvector/data/unit5.mat similarity index 100% rename from projects/project_populationvector/unit5.mat rename to projects/project_populationvector/data/unit5.mat diff --git a/projects/project_populationvector/unit6.mat b/projects/project_populationvector/data/unit6.mat similarity index 100% rename from projects/project_populationvector/unit6.mat rename to projects/project_populationvector/data/unit6.mat diff --git a/projects/project_populationvector/populationvector.tex b/projects/project_populationvector/populationvector.tex index 44c1b62..9ebcf32 100644 --- a/projects/project_populationvector/populationvector.tex +++ b/projects/project_populationvector/populationvector.tex @@ -1,37 +1,17 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Orientation tuning} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% - \begin{questions} + \question In the visual cortex V1 orientation sensitive neurons respond to bars in dependence on their orientation. @@ -55,6 +35,9 @@ \texttt{spikes} variables of the \texttt{population*.mat} files. The \texttt{angle} variable holds the angle of the presented bar. +NOTE: the orientation is angle plu 90 degree!!!!!! + +\continue \begin{parts} \part Illustrate the spiking activity of the V1 cells in response to different orientation angles of the bars by means of spike @@ -97,6 +80,9 @@ \end{parts} \end{questions} +NOTE: change data generation such that the phase variable is indeed +the maximum response and not the minumum! + \end{document} gains and angles of the 6 neurons: diff --git a/projects/project_populationvector/solution/populationvector.m b/projects/project_populationvector/solution/populationvector.m index 829e07d..134b8ed 100644 --- a/projects/project_populationvector/solution/populationvector.m +++ b/projects/project_populationvector/solution/populationvector.m @@ -16,6 +16,7 @@ end close all cosine = @(p,xdata)0.5*p(1).*(1.0-cos(2.0*pi*(xdata/180.0-p(2)))); files = dir('../unit*.mat'); +phases = zeros(length(files), 1); figure() for j = 1:length(files) file = files(j); @@ -31,7 +32,11 @@ for j = 1:length(files) p0 = [mr, angles(maxi)/180.0-0.5]; %p = p0; p = lsqcurvefit(cosine, p0, angles, rates'); - phase = p(2)*180.0 + phase = p(2)*180.0 + 90.0; + if phase > 180.0 + phase = phase - 180.0; + end + phases(j) = phase; subplot(2, 3, j); plot(angles, rates, 'b'); hold on; @@ -41,3 +46,73 @@ for j = 1:length(files) ylim([0.0 50.0]) title(sprintf('unit %d', j)) end + + +%% read out: +a = load('../population04.mat'); +spikes = a.spikes; +angle = a.angle; +unitphases = a.phases*180.0 + 90.0; +unitphases(unitphases>180.0) = unitphases(unitphases>180.0) - 180.0; +figure(); +subplot(1, 3, 1); +angleestimates1 = zeros(size(spikes, 2), 1); +angleestimates2 = zeros(size(spikes, 2), 1); +for j = 1:size(spikes, 2) + rates = zeros(size(spikes, 1), 1); + for k = 1:size(spikes, 1) + r = firingrate(spikes(k, j), 0.0, 0.2); + rates(k) = r; + end + [x, inx] = sort(phases); + plot(phases(inx), rates(inx), '-o'); + hold on; + angleestimates1(j) = popvecangle(phases, rates); + [m, i] = max(rates); + angleestimates2(j) = phases(i); +end +hold off; +subplot(1, 3, 2); +hist(angleestimates1); +subplot(1, 3, 3); +hist(angleestimates2); +angle +mean(angleestimates1) +mean(angleestimates2) + + +%% read out robustness: +files = dir('../population*.mat'); +angles = zeros(length(files), 1); +e1m = zeros(length(files), 1); +e1s = zeros(length(files), 1); +e2m = zeros(length(files), 1); +e2s = zeros(length(files), 1); +for i = 1:length(files) + file = files(i); + a = load(strcat('../', file.name)); + spikes = a.spikes; + angle = a.angle; + angleestimates1 = zeros(size(spikes, 2), 1); + angleestimates2 = zeros(size(spikes, 2), 1); + for j = 1:size(spikes, 2) + rates = zeros(size(spikes, 1), 1); + for k = 1:size(spikes, 1) + r = firingrate(spikes(k, j), 0.0, 0.2); + rates(k) = r; + end + angleestimates1(j) = popvecangle(phases, rates); + [m, inx] = max(rates); + angleestimates2(j) = phases(inx); + end + angles(i) = angle; + e1m(i) = mean(angleestimates1); + e1s(i) = std(angleestimates1); + e2m(i) = mean(angleestimates2); + e2s(i) = std(angleestimates2); +end +figure(); +subplot(1, 2, 1); +scatter(angles, e1m); +subplot(1, 2, 2); +scatter(angles, e2m); diff --git a/projects/project_populationvector/solution/popvecangle.m b/projects/project_populationvector/solution/popvecangle.m new file mode 100644 index 0000000..c06a773 --- /dev/null +++ b/projects/project_populationvector/solution/popvecangle.m @@ -0,0 +1,13 @@ +function angle = popvecangle(phases, rates) +% estimate population vector +vecs = zeros(2, length(phases)); +norm = sum(rates); +vecs(1, :) = rates.*cos(2*pi*phases/180.0)/norm; +vecs(2, :) = rates.*sin(2*pi*phases/180.0)/norm; +mvec = mean(vecs, 2); +angle = atan2(mvec(2), mvec(1)); +angle = angle/2/pi*180.0; +if angle < 0 + angle = angle + 180.0; +end +end diff --git a/projects/project_q-values/Makefile b/projects/project_q-values/Makefile deleted file mode 100644 index dad25ce..0000000 --- a/projects/project_q-values/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null - -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat diff --git a/projects/project_qvalues/Makefile b/projects/project_qvalues/Makefile new file mode 100644 index 0000000..a7b3726 --- /dev/null +++ b/projects/project_qvalues/Makefile @@ -0,0 +1,3 @@ +ZIPFILES= + +include ../project.mk diff --git a/projects/project_q-values/p_values.dat b/projects/project_qvalues/data/p_values.dat similarity index 100% rename from projects/project_q-values/p_values.dat rename to projects/project_qvalues/data/p_values.dat diff --git a/projects/project_q-values/qvalues.tex b/projects/project_qvalues/qvalues.tex similarity index 74% rename from projects/project_q-values/qvalues.tex rename to projects/project_qvalues/qvalues.tex index 349182e..9127ba2 100644 --- a/projects/project_q-values/qvalues.tex +++ b/projects/project_qvalues/qvalues.tex @@ -1,33 +1,13 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Fabian Sinz} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{q-values} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_random_walk/Makefile b/projects/project_random_walk/Makefile index 437b664..a7b3726 100644 --- a/projects/project_random_walk/Makefile +++ b/projects/project_random_walk/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat data/*.mat +include ../project.mk diff --git a/projects/project_random_walk/random_walk.tex b/projects/project_random_walk/random_walk.tex index 797623f..db0fb84 100644 --- a/projects/project_random_walk/random_walk.tex +++ b/projects/project_random_walk/random_walk.tex @@ -1,32 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Random walk} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Random walk with memory.} diff --git a/projects/project_serialcorrelation/Makefile b/projects/project_serialcorrelation/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_serialcorrelation/Makefile +++ b/projects/project_serialcorrelation/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_serialcorrelation/baselinespikes.mat b/projects/project_serialcorrelation/data/baselinespikes.mat similarity index 100% rename from projects/project_serialcorrelation/baselinespikes.mat rename to projects/project_serialcorrelation/data/baselinespikes.mat diff --git a/projects/project_serialcorrelation/serialcorrelation.tex b/projects/project_serialcorrelation/serialcorrelation.tex index 74162df..1e583a3 100644 --- a/projects/project_serialcorrelation/serialcorrelation.tex +++ b/projects/project_serialcorrelation/serialcorrelation.tex @@ -1,33 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Serial ISI correlations} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_spectra/Makefile b/projects/project_spectra/Makefile index dad25ce..a7b3726 100644 --- a/projects/project_spectra/Makefile +++ b/projects/project_spectra/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat +include ../project.mk diff --git a/projects/project_spectra/2014-06-06-ad_p-unit.mat b/projects/project_spectra/data/2014-06-06-ad_p-unit.mat similarity index 100% rename from projects/project_spectra/2014-06-06-ad_p-unit.mat rename to projects/project_spectra/data/2014-06-06-ad_p-unit.mat diff --git a/projects/project_spectra/spectra.tex b/projects/project_spectra/spectra.tex index 51aa2e4..770f57b 100644 --- a/projects/project_spectra/spectra.tex +++ b/projects/project_spectra/spectra.tex @@ -1,33 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Fabian Sinz} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Spectra} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} - -\begin{center} - \input{../disclaimer.tex} -\end{center} + +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/projects/project_steady_fi/Makefile b/projects/project_steady_fi/Makefile deleted file mode 100644 index dad25ce..0000000 --- a/projects/project_steady_fi/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null - -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat diff --git a/projects/project_steady_state_fi/Makefile b/projects/project_steady_state_fi/Makefile new file mode 100644 index 0000000..a7b3726 --- /dev/null +++ b/projects/project_steady_state_fi/Makefile @@ -0,0 +1,3 @@ +ZIPFILES= + +include ../project.mk diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-14.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-14.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-14.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-14.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-18.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-18.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-18.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-18.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-2.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-2.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-2.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-2.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-6.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-6.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-6.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-6.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-9.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-9.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_-9.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_-9.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_12.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_12.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_12.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_12.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_15.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_15.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_15.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_15.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_2.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_2.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_2.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_2.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_5.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_5.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_5.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_5.mat diff --git a/projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_9.mat b/projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_9.mat similarity index 100% rename from projects/project_steady_fi/p_unit_2012-03-30-aa_fi_curve_9.mat rename to projects/project_steady_state_fi/data/p_unit_2012-03-30-aa_fi_curve_9.mat diff --git a/projects/project_steady_fi/steady_state_fi.tex b/projects/project_steady_state_fi/steady_state_fi.tex similarity index 70% rename from projects/project_steady_fi/steady_state_fi.tex rename to projects/project_steady_state_fi/steady_state_fi.tex index 5f6d8c6..abba436 100644 --- a/projects/project_steady_fi/steady_state_fi.tex +++ b/projects/project_steady_state_fi/steady_state_fi.tex @@ -1,33 +1,14 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Steady-state f-I curve} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Quantifying the responsiveness of a neuron using the F-I curve.} diff --git a/projects/project_stimulus_reconstruction/Makefile b/projects/project_stimulus_reconstruction/Makefile index 2574730..a7b3726 100644 --- a/projects/project_stimulus_reconstruction/Makefile +++ b/projects/project_stimulus_reconstruction/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf data/*.mat +include ../project.mk diff --git a/projects/project_stimulus_reconstruction/stimulus_reconstruction.tex b/projects/project_stimulus_reconstruction/stimulus_reconstruction.tex index 222292d..0730ab0 100644 --- a/projects/project_stimulus_reconstruction/stimulus_reconstruction.tex +++ b/projects/project_stimulus_reconstruction/stimulus_reconstruction.tex @@ -1,32 +1,13 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Reverse reconstruction} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Reverse reconstruction of the stimulus evoking neuronal responses.} diff --git a/projects/project_template/Makefile b/projects/project_template/Makefile index 6422eb4..a7b3726 100644 --- a/projects/project_template/Makefile +++ b/projects/project_template/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m +include ../project.mk diff --git a/projects/project_template/template.tex b/projects/project_template/template.tex index 8290b77..e8afc87 100644 --- a/projects/project_template/template.tex +++ b/projects/project_template/template.tex @@ -1,33 +1,16 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014 - -- 11/06/2014} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Project title} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Benda}{phone: 29 74573}% +{email: jan.benda@uni-tuebingen.de} +%\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +%{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} + %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% @@ -35,8 +18,4 @@ \question What was the questions for 42? \end{questions} - - - - \end{document} diff --git a/projects/project_vector_strength/Makefile b/projects/project_vector_strength/Makefile index 064bfc3..a7b3726 100644 --- a/projects/project_vector_strength/Makefile +++ b/projects/project_vector_strength/Makefile @@ -1,10 +1,3 @@ -latex: - pdflatex *.tex > /dev/null - pdflatex *.tex > /dev/null +ZIPFILES= -clean: - rm -rf *.log *.aux *.zip *.out auto - rm -f `basename *.tex .tex`.pdf - -zip: latex - zip `basename *.tex .tex`.zip *.pdf data/*.mat +include ../project.mk diff --git a/projects/project_vector_strength/export_data.py b/projects/project_vector_strength/code/export_data.py similarity index 100% rename from projects/project_vector_strength/export_data.py rename to projects/project_vector_strength/code/export_data.py diff --git a/projects/project_vector_strength/vector_strength.tex b/projects/project_vector_strength/vector_strength.tex old mode 100755 new mode 100644 index edbfbed..56e8c78 --- a/projects/project_vector_strength/vector_strength.tex +++ b/projects/project_vector_strength/vector_strength.tex @@ -1,32 +1,13 @@ -\documentclass[addpoints,11pt]{exam} -\usepackage{url} -\usepackage{color} -\usepackage{hyperref} - -\pagestyle{headandfoot} -\runningheadrule -\firstpageheadrule -\firstpageheader{Scientific Computing}{Project Assignment}{WS 2016/17} -%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014} -\firstpagefooter{}{}{{\bf Supervisor:} Jan Grewe} -\runningfooter{}{}{} -\pointsinmargin -\bracketedpoints - -%\printanswers -%\shadedsolutions +\documentclass[a4paper,12pt,pdftex]{exam} +\newcommand{\ptitle}{Vector strength} +\input{../header.tex} +\firstpagefooter{Supervisor: Jan Grewe}{phone: 29 74588}% +{email: jan.grewe@uni-tuebingen.de} \begin{document} -%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%% -\sffamily -% \begin{flushright} -% \gradetable[h][questions] -% \end{flushright} -\begin{center} - \input{../disclaimer.tex} -\end{center} +\input{../instructions.tex} %%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%% \section*{Quantifying the coupling of action potentials to the EOD.} diff --git a/scientificcomputing-script.tex b/scientificcomputing-script.tex index b8533c8..6f194f7 100644 --- a/scientificcomputing-script.tex +++ b/scientificcomputing-script.tex @@ -24,7 +24,7 @@ \mainmatter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\part{Grundlagen des Programmierens} +\part{The Basics} \graphicspath{{programming/lecture/}{programming/images/}} \lstset{inputpath=programming/code} @@ -32,8 +32,8 @@ \graphicspath{{debugging/lecture/}{debugging/lecture/figures/}} \lstset{inputpath=debugging/code} -\selectlanguage{english} -\include{programming/lecture/debugging} +%\selectlanguage{english} +\include{debugging/lecture/debugging} \selectlanguage{ngerman} \graphicspath{{plotting/lecture/}{plotting/lecture/images/}}