This commit is contained in:
Jan Grewe 2020-11-10 08:54:43 +01:00
commit 40e06d7eaa
5 changed files with 22 additions and 11 deletions

View File

@ -5,7 +5,7 @@
\author{{\LARGE Jan Grewe \& Jan Benda}\\[5ex]Abteilung Neuroethologie\\[2ex]%
\includegraphics[width=0.3\textwidth]{UT_WBMW_Rot_RGB}\vspace{3ex}}
\date{WS 2019/2020\\\vfill%
\date{WS 2020/2021\\\vfill%
\centerline{\includegraphics[width=0.7\textwidth]{announcements/correlationcartoon}%
\rotatebox{90}{\footnotesize\url{www.xkcd.com}}}}

View File

@ -15,7 +15,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Exercise 1}}{{\bfseries\large Variables und Datatypes}}{{\bfseries\large 15. Oktober, 2019}}
\header{{\bfseries\large Exercise 1}}{{\bfseries\large Variables und Datatypes}}{{\bfseries\large 03. November, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de}
\runningfooter{}{\thepage}{}

View File

@ -14,7 +14,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Exercise 2}}{{\bfseries\large Vectors}}{{\bfseries\large 17. Oktober, 2019}}
\header{{\bfseries\large Exercise 2}}{{\bfseries\large Vectors}}{{\bfseries\large 03. November, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de}
\runningfooter{}{\thepage}{}
@ -41,7 +41,7 @@ lecture. 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''
following pattern: ``vectors\_\{lastname\}.m''
(e.g. vectors\_mueller.m).
\begin{questions}
@ -159,7 +159,7 @@ following pattern: ``variables\_datatypes\_\{lastname\}.m''
\begin{solution}
\code{x = linspace(0, 99, 100);}
\end{solution}
\part use \code{disp()) to display the first, last, fifth, 24th and the second-to-last value on the command line.
\part use \code{disp()} to display the first, last, fifth, 24th and the second-to-last value on the command line.
\begin{solution}
\code{disp(x(1))\\ disp(x(end))\\ disp(x(5))\\ disp(x(24))\\ disp(x(end-1))}
\end{solution}

View File

@ -14,7 +14,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Exercise 2}}{{\bfseries\large Vectors}}{{\bfseries\large 18. Oktober, 2017}}
\header{{\bfseries\large Exercise 2}}{{\bfseries\large Vectors}}{{\bfseries\large 03. November, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de}
\runningfooter{}{\thepage}{}

View File

@ -18,7 +18,7 @@ simple.
The ultimate goal of scientific computing is to analyze gathered data,
correlate it with e.g. the stimulus conditions and infer rules and
dependencies. These may be used to constrain model that allow us to
dependencies. These may be used to constrain models which allow us to
understand and predict a system's behavior. In order to work with data
we need to store it somehow. For this purpose we use containers called
\emph{variables}. Variables store the data and are named for easier
@ -83,8 +83,8 @@ the \code{double} (a numeric data type, see below) data type. In
line 9, however, we create a variable \varcode{z} and assign the
character ``A'' to it. Accordingly, \varcode{z} does not have the
numeric \code{double} data type but is a
\enterm{character} type. \textbf{Note:} \matlab{} uses single quotes for
both characters or strings of characters.
\enterm{character} type. \textbf{Note:} \matlab{} uses single quotes
for characters and double quotes for strings of characters.
There are two ways to find out the actual data type of a variable: the
\code{class()} and the \code{whos} functions. While \code{class()}
@ -190,8 +190,8 @@ represented (table~\ref{dtypestab}).
Data type & memory demand & range & example \erh \\ \hline
\code{single} & 32 bit & $\approx -3.4^{38}$ to $\approx 3.4^{38}$ & Floating point numbers.\erb \\
\code{double} & 64 bit & $\approx -10^{308}$ to $\approx 10^{308}$ &
Floating point numbers.\erb\\ \code{int} & 64 bit & $-2^{31}$
to $2^{31}-1$ & Integer values. \\ \code{int16} & 16 bit &
Floating point numbers.\erb\\ \code{int} & 64 bit & $-2^{63}$
to $2^{63}-1$ & Integer values. \\ \code{int16} & 16 bit &
$-2^{15}$ to $2^{15}-1$ & Digitizes measurements. \\ \code{uint8}
& 8 bit & $0$ bis $255$ & Digitized intensities of colors in
images. \\ \hline
@ -402,6 +402,17 @@ ans =
could you find out the size of the \varcode{a} in the 2nd dimension?
\end{exercise}
\begin{important}[The : (colon) operator]
The colon \code[Operator!colon@:]{:} operator is often used when working with vectors. It has multiple purposes.
\begin{enumerate}
\item In the simplest form, \code{x = a:b} with \code{a} and \code{b} being two numbers, it creates
a vector \code{x} containing the numbers \code{a} to \code{b} in integer steps. In \matlab{} the borders $a$ and $b$ are included $[a, b]$ or $a\leq x \leq b$.
\item In the form \code{x = a:c:b} the vector \code{x} uses a \emph{stepsize} of \code{c} to create the range of numbers.
\item When used in the context of indexing such as \code{x(:)} all elements of the vector x are accessed.
\item As vectors are often used for indexing in other vectors one use the colon operator to create such vectors implicitely, e.g. \varcode{x(1:2:end)} to access every seond element of \code{x}.
\end{enumerate}
\end{important}
\subsubsection{Operations on vectors}
Similarly to the scalar variables discussed above we can work with