\documentclass[a4paper,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{graphicx} %BIlder einbinden
\usepackage{amsmath} %erweiterte Mathe-Zeichen
\usepackage{amsfonts} %weitere fonts
\usepackage[utf8]{inputenc} %Umlaute & Co
\usepackage{hyperref} %Links
\usepackage{ifthen} %ifthenelse
\usepackage{enumerate}
\usepackage{pdfpages}
\usepackage{algpseudocode} %Pseudocode
\usepackage{dsfont} % schöne Zahlenräumezeichen
\usepackage{amssymb, amsthm} %noch stärker erweiterte Mathe-Zeichen
\usepackage{tikz} %TikZ ist kein Zeichenprogramm
\usetikzlibrary{trees,automata,arrows,shapes}
\usepackage{qtree}
\usepackage{listings}
\lstset{language=Matlab}

\pagestyle{empty}


\topmargin-50pt

\newcounter{aufgabe}
\def\tand{&}

\newcommand{\makeTableLine}[2][0]{%
  \setcounter{aufgabe}{1}%
  \whiledo{\value{aufgabe} < #1}%
  {%
    #2\tand\stepcounter{aufgabe}%
  }
}

\newcommand{\aufgTable}[1]{
  \def\spalten{\numexpr #1 + 1 \relax}
  \begin{tabular}{|*{\spalten}{p{1cm}|}}
    \makeTableLine[\spalten]{A\theaufgabe}$\Sigma$~~\\ \hline
    \rule{0pt}{15pt}\makeTableLine[\spalten]{}\\
  \end{tabular}
}

\def\header#1#2#3#4#5#6#7{\pagestyle{empty}
\begin{minipage}[t]{0.47\textwidth}
\begin{flushleft}
{\bf #4}\\
#5
\end{flushleft}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{flushright}
#6 \vspace{0.5cm}\\
%                 Number of Columns    Definition of Columns      second empty line
% \begin{tabular}{|*{5}{C{1cm}|}}\hline A1&A2&A3&A4&$\Sigma$\\\hline&&&&\\\hline\end{tabular}\\\vspace*{0.1cm}
\aufgTable{#7}
\end{flushright}
\end{minipage}
\vspace{1cm}
\begin{center}
{\Large\bf Assignment #1}

{(Hand-in date #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

%Kommando für Aufgaben
%\Aufgabe{AufgTitel}{Punktezahl}
\newcommand{\Aufgabe}[2]{\stepcounter{n}
\textbf{Exercise \arabic{n}: #1} (#2 Punkte)\\}

\newcommand{\Normal}[3]{\mathcal{N}\left(#1,#2,#3\right)}
\newcommand{\Normalf}[3]{\frac{1}{#3 \cdot\sqrt{2\pi}}e^{-\frac{\left(#1 - #2 \right)^2}{2 #3 ^2}}}
\newcommand{\Normalfs}[3]{\frac{1}{#3}e^{-\frac{\left(#1 - #2 \right)^2}{2 #3 ^2}}}




\begin{document}
    %\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
    \header{8}{}{2015-06-23}{Mobile Robots}{
        \textit{Jan-Peter Hohloch}\\ \textit{Maximus Mutschler}
    }{SS 15}{2}
    \vspace{1cm}

    \Aufgabe{Excercise 1}{10}
    \includegraphics[width=\textwidth]{localize.png}\\
    %\lstinputlisting{localize_jp/motion_diff.m}
    %\lstinputlisting{localize_jp/measurement.m}
    d)
        The uncertainty in one direction decreases. This causes the estimated trajectory to be quite wiggly (overfitting). We overtrust the measurement.\\
        For $Q_t$ near to $0$, we get:
        \begin{align*}
            K_t&=\overline{\Sigma}_tC^T\left(C\overline{\Sigma}_tC^T+0\right)^{-1}\\
            &=C^{-1}\\
            \mu_t&=\overline{\mu}_t+C^{-1}z_t-\overline{\mu}_t\\
            &=C^{-1}z_t\\
            \Sigma_t&=0
        \end{align*}
        That is we assume no variance and fully trust the measurement.\pagebreak\\
\Aufgabe{Excercise2}{8}
\begin{enumerate}[(a)]
    \item %TODO Herleitung
        \begin{itemize}
            \item $p(x_{t-1})=\mathcal{N}\left(x_{t-1},\hat{x}_{t-1},\sigma_{t-1}\right)$
            \item $p(z_t)=\mathcal{N}\left(z_t,cx_t,r_t\right)$
            \item $p(x_t)=\mathcal{N}\left(x_t,a\mu_{t-1},q_t\right)$
        \end{itemize}
    \item \begin{align*}
            \Normal{x_t}{ax_{t-1}}{q_t}&=\eta\Normal{z_t}{cx_t}{r_t}\Normal{x_{t-1}}{\hat{x}_{t-1}}{\sigma_{t-1}}\\
            \Normalf{x_t}{ax_{t-1}}{q_t}&=\eta\Normalf{z_t}{cx_t}{r_t}\Normalf{x_{t-1}}{\hat{x}_{t-1}}{\sigma_{t-1}}\\
            \Normalfs{x_t}{ax_{t-1}}{q_t}&=\eta\Normalfs{z_t}{cx_t}{r_t}\Normalfs{x_{t-1}}{\hat{x}_{t-1}}{\sigma_{t-1}}
        \end{align*}
        %TODO
	 \item $p(x_t|z_{t,\dots1},u_{t,\dots1})\sim N(x_t,\mu_{x,t},\sigma_{x,t})\\
	 \mu_{x,t}= a\mu_{x,t-1}+bu_t+\epsilon_t\\
	 \sigma_{x,t}= |a|\sigma_{x,t-1}\\
	 \\
	 p(x_{t}|z_{t,\dots1},u_{t,\dots1})\sim N(x_{t-1},\mu_{x,t-1},\sigma_{x,t-1})\\
	 \mu_{x,t-1}= a\mu_{x,t-2}+bu_{t-1}+\epsilon_{t-1}\\
	 \sigma_{x,t-1}= |a|\sigma_{x,t-2}\\
	 \\
	 p(z_t|x_t)\sim N(z_t,\mu_z,\sigma_z)\\
	 \mu_z=c*\mu_{x,t}+\delta_t \\
	 \sigma_z=|c|\sigma_{x,t}
	 $
\end{enumerate}

\end{document}

