[programming] update exercises

This commit is contained in:
Jan Grewe 2020-12-20 13:39:11 +01:00
parent c0f54682f4
commit cd90a132a6
3 changed files with 23 additions and 22 deletions

View File

@ -1,4 +1,4 @@
\documentclass[12pt,a4paper,pdftex, answers]{exam}
\documentclass[12pt, a4paper, pdftex]{exam}
\usepackage[german]{babel}
\usepackage{natbib}
@ -14,7 +14,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot} \header{{\bfseries\large Exercise 4
}}{{\bfseries\large Boolean expressions and logical indexing}}{{\bfseries\large 29. Oktober, 2019}}
}}{{\bfseries\large Boolean expressions \& logical indexing}}{{\bfseries\large 17. November, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de} \runningfooter{}{\thepage}{}
@ -40,8 +40,8 @@ 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''
(e.g. variables\_datentypes\_mueller.m).
following pattern: ``boolean\_logical\_indexing\_\{lastname\}.m''
(e.g. boolean\_logical\_indexing\_mueller.m).
\section{Boolean expressions}

View File

@ -1,4 +1,4 @@
\documentclass[12pt,a4paper,pdftex, answers]{exam}
\documentclass[12pt,a4paper,pdftex]{exam}
\usepackage[german]{babel}
\usepackage{natbib}
@ -14,7 +14,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Exercise 5}}{{\bfseries\large Control Flow}}{{\bfseries\large 05. November, 2019}}
\header{{\bfseries\large Exercise 5}}{{\bfseries\large Control Flow}}{{\bfseries\large 24. November, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de}
\runningfooter{}{\thepage}{}
@ -41,13 +41,13 @@ 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''
(e.g. variables\_datentypes\_mueller.m).
following pattern: ``control\_flow\_\{lastname\}.m''
(e.g. control\_flow\_mueller.m).
\begin{questions}
\question Implement \code{for} loops in which the \emph{running variable}:
\question Implement \code{for} loops in which the \emph{running variable}:
\begin{parts}
\part ... assumes values from 0 to 10. Print (\code{disp}) the value of the running variable for each iteration step.
\part ... assumes values from 0 to 10. Display (\code{disp}) the value of the running variable for each iteration of the loop.
\begin{solution}
for i = 1:10 disp(i); end;
\end{solution}
@ -252,7 +252,7 @@ following pattern: ``variables\_datatypes\_\{lastname\}.m''
\part Create a variable
\verb+filename = '2015-10-12_100Hz_1.25V.dat'+. Obviously, the
underscore was used as a delimiter.
\part Use a \verb+for+ loop to find the positions of the underscores and store these in a vector.
\part Use a \verb+for+ loop to find the positions of the underscores and store these positions in a vector.
\begin{solution}
\begin{verbatim}
positions = [];

View File

@ -16,9 +16,9 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot}
\header{{\bfseries\large Exercise 6}}{{\bfseries\large Scripts and functions}}{{\bfseries\large 06. November, 2018}}
\firstpagefooter{Prof. Jan Benda}{Phone: 29 74 573}{Email:
jan.benda@uni-tuebingen.de}
\header{{\bfseries\large Exercise 6}}{{\bfseries\large Scripts and functions}}{{\bfseries\large 01. December, 2020}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74 588}{Email:
jan.grewe@uni-tuebingen.de}
\runningfooter{}{\thepage}{}
\setlength{\baselineskip}{15pt}
@ -71,7 +71,7 @@ to the pattern: ``scripts\_functions\_\{surname\}.zip''.
\begin{parts}
\part{}
Version 1: Write a script that calculates the factorial of 5 and
prints out the result.
displays the result on the command line.
\begin{solution}
\lstinputlisting{factorialscripta.m}
\end{solution}
@ -86,8 +86,8 @@ to the pattern: ``scripts\_functions\_\{surname\}.zip''.
\part{}
Version 3: like version 2, but the calculated result should not be
printed on the command line but returned by the function. Write a
script that calls the function and prints out the result.
displayed on the command line but returned by the function. Write a
script that calls the function, accepts the returned value and then displays the result.
\begin{solution}
\lstinputlisting{myfactorial.m}
\lstinputlisting{factorialscriptc.m}
@ -116,7 +116,7 @@ to the pattern: ``scripts\_functions\_\{surname\}.zip''.
\part{}
Write a script that calls the function and controls the
plotting. Change the function in a way that it returns a proper
plotting. Change the function in a way that it returns
time-axis and the calculated sinwave.
\begin{solution}
\lstinputlisting{sinewave.m}
@ -148,10 +148,11 @@ to the pattern: ``scripts\_functions\_\{surname\}.zip''.
\begin{parts}
\part{}
Read the exercise completely before starting the implementation
and then come up with a proper program layout of scripts and
functions. What would be a suitable function to solve the task? Which
arguments should it take? Which results should it return?
Read the exercise instructions completely before you start
implementing a solution. Analyze the requirements and then come up with a
program layout of scripts and functions. What would be a
suitable function to solve the core task? Which arguments should it
take? Which results should it return?
\begin{solution}
One function that computes one realisation of a random walk.
Scripts for plotting and analysis.