\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{color}
\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{pgfplots}

\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 Blatt #1}

{(Abgabe #3)}
\end{center}
}



%counts the exercisenumber
\newcounter{n}

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

\newcommand{\textcorr}[1]{\textcolor{red}{#1}}
\newenvironment{corr}{\color{red}}{\color{black}\newline}
\newcommand{\ok}{\begin{corr}
      $\checkmark$
  \end{corr}}

\begin{document}
%\header{BlattNr}{Tutor}{Abgabedatum}{Vorlesungsname}{Namen}{Semester}{Anzahl Aufgaben}
\header{4}{}{2015-11-11}{Kommunikationsnetze}{\textit{Jonas Jaszkowic, 3592719}\\\textit{Jan-Peter Hohloch, 3908712}}{WS 15/16}{4}
\vspace{1cm}
\Aufgabe{Scrambling}{5+5+10+10}
\begin{enumerate}
  \item To be perfectly in sync, the transmitter and receiver must have access to very accurate and identical time signals.
  Due to technical difficulties this is often not the case, so that transmitter and receiver have slightly different time signals.
  This results in incorrectly assigned bits, e.g. when the receiver reads a bit short time later than it is supposed to do.
  \item Synchronization issues can be fixed by introducing synchronization bits in the signal. Usually the signal must
  be chunked into frames, at the beginning of each frame a synchronization bit is added. Subsequent synchronization bits form
  a specific binary pattern which repeats at a regular interval in the stream. This is used to identify the current
  synchronization state (in sync vs. out of sync).
  \item The bit sequence $011000000000100000000110$ is given.
    \begin{itemize}
      \item[a)] AMI (Alternate Mark Inversion, 0 is encoded as zero,
      1 is alternately encoded as positive or negative voltage):
      \begin{align*}
          0+-000000000+00000000-+0
      \end{align*}
       B8ZS substitutes eight consecutive zeros with $000VB0VB$: ($+00000000$ is encoded as $+000+-0-+$, $-00000000$ is encoded as $-000-+0+-0$):
       \begin{align*}
         0+\mathbf{-000-+0+-0}\mathbf{+000+-0-+}
       \end{align*}
      \item[b)] HDB3 ($0$ is encoded as $0$, $1$ is alternately encoded as positive or negative voltage,
      $0000$ as $000V$, where $V$ is a violation pulse, $0000 0000$ as $B00V B00V$, where $B$ is a balancing pulse):
      \begin{align*}
        0+-\mathbf{B00V B00V}0+\mathbf{B00V B00V}-+0
      \end{align*}
    \end{itemize}
\end{enumerate}
\Aufgabe{Pulse-Code Modulation}{15+15+5+5}
\begin{enumerate}
  \item We have $8$ available levels from $0$ to $7$. The sampling points lead to the level sequence $3,6,0,2,6,4,1,2,3$ and thus to
  the word sequence $011,110,000,010,110,100,001,010,011$.
  \item The word sequence $011,110,000,010,110,100,001,010,011$ modulated using the given constellation diagram and a sine as the carrier.
  The amplitude modulations are $-1, 1, -2, -1, 1, 2, -2, 1$ and $-2$. The phase modulations are $10/8, 2/8, 7/8, 6/8, 2/8, 1/8, 9/8, 6/8$ and $10/8$ of $\pi$.
  Two periods of each word are shown: \par
  \begin{minipage}{\linewidth}
      \centering
      \includegraphics[width=\linewidth]{QAM8.png}
  \end{minipage}
  \item According to the Nyquist theorem, the sampling rate $f_s$ must be at least 2 times the highest frequency contained in the signal.
  Thus, a sampling rate of $2 \cdot 4kHz = 8kHz$ is necessary for human voice.
  \item The minimum bandwidth for transmission of PCM modulated signals is given as:
  \begin{align*}
    B_{PCM} = c \cdot 2 \cdot B_{analog} \cdot n_{b} \cdot \frac{1}{r}
  \end{align*}
  where $c$ is the average probability, that the next bit changes ($c = 0.5$), $r$ is the number of data per signal (here $r = 2$)\begin{corr}$r=4$\end{corr}).
  Therefore the required bandwidth is:
  \begin{align*}
      B = 0.5 \cdot 8000Hz \cdot 8bit \cdot \frac{1}{\begin{corr}4\end{corr}} = \begin{corr}8\end{corr}kHz
  \end{align*}
\end{enumerate}
\Aufgabe{Modulation}{10+10+10}
\begin{enumerate}
  \item Binary Amplitude Shift Keying (BASK): \par
  \begin{minipage}{\linewidth}
      \centering
      \includegraphics[width=\linewidth]{BASK.png}
  \end{minipage}
  \item Binary Frequency Shift Keying (BFSK): \par
  \begin{minipage}{\linewidth}
      \centering
      \includegraphics[width=\linewidth]{BFSK.png}
  \end{minipage}
  \item Binary Phase Shift Keying (BPSK): \par
  \begin{minipage}{\linewidth}
      \centering
      \includegraphics[width=\linewidth]{BPSK.png}
  \end{minipage}
\end{enumerate}
\begin{corr}tables missing\end{corr}
\end{document}
