\documentclass[12pt,a4paper,austrian]{article}
\usepackage{graphicx}
\usepackage[austrian, english]{babel}
\usepackage[utf8]{inputenc}
%\usepackage{listings}
\usepackage{multirow}
\usepackage{epstopdf}
\usepackage{amsmath}
\usepackage{amssymb} % fuer Mengen \N, Q, C, R
\graphicspath{{./fig/}}


%% Satzspiegel
\setlength{\hoffset}{-1in} \setlength{\textwidth}{18cm}
\setlength{\oddsidemargin}{1.5cm}
\setlength{\evensidemargin}{1.5cm}
\setlength{\marginparsep}{0.7em}
\setlength{\marginparwidth}{0.5cm}

\setlength{\voffset}{-1.9in}
\setlength{\headheight}{12pt}
\setlength{\topmargin}{2.6cm}
   \addtolength{\topmargin}{-\headheight}
\setlength{\headsep}{3.5cm}
   \addtolength{\headsep}{-\topmargin}
   \addtolength{\headsep}{-\headheight}
\setlength{\textheight}{27cm}

%% How should floats be treated?
\setlength{\floatsep}{12 pt plus 0 pt minus 8 pt}
\setlength{\textfloatsep}{12 pt plus 0pt minus 8 pt}
\setlength{\intextsep}{12 pt plus 0pt minus 8 pt}

\tolerance2000
\emergencystretch20pt

%% Text appearence
% English text
\newcommand{\eg}[1]%
  {\selectlanguage{english}\textit{#1}\selectlanguage{austrian}}

\newcommand{\filename}[1]
  {\begin{small}\texttt{#1}\end{small}}

\newcommand\IFT{\unitlength1mm\begin{picture}(10,2) \put (1,1)
{\circle{1.7}} \put(2,1){\line(1,0){5}} \put(8,1)
{\circle*{1.7}}\end{picture}}
\newcommand\FT{\unitlength1mm\begin{picture}(10,2) \put (1,1)
{\circle*{1.7}} \put(2,1){\line(1,0){5}} \put(8,1)
{\circle{1.7}}\end{picture}}

% A box for multiple choice problems
\newcommand{\choicebox}{\fbox{\rule{0pt}{0.5ex}\rule{0.5ex}{0pt}}}

\newenvironment{wahrfalsch}%
  {\bigskip\par\noindent\makebox[1cm][c]{richtig}\hspace{3mm}\makebox[1cm][c]{falsch}
   \begin{list}%
   {\makebox[1cm][c]{\choicebox}\hspace{3mm}\makebox[1cm][c]{\choicebox}}%
   {\setlength{\labelwidth}{2.31 cm}\setlength{\labelsep}{3mm}
    \setlength{\leftmargin}{2.61 cm}\setlength{\listparindent}{0pt}
    \setlength{\itemindent}{0pt}}%
  }
  {\end{list}}

\newcounter{theaufgabe}\setcounter{theaufgabe}{1}
\newenvironment{aufgabe}[1]%
  {\bigskip\par\noindent\begin{nopagebreak}
   \textsf{\textbf{\arabic{theaufgabe}.\thinspace Exercise}}\quad
      \textsf{\textit{#1}}\\*[1ex]%
\stepcounter{theaufgabe}\hspace{2ex}\end{nopagebreak}}
  {\par\pagebreak[2]}

% Innerhalb der Aufgaben erfolgt die weitere Unterteilung mittels einer
% enumerate Umgebung, die allerdings a), b),... zaehlen soll.
\renewcommand{\labelenumi}{\alph{enumi})}
\renewcommand{\labelenumii}{\arabic{enumii})}

% A box to tick for everything which has to done
\newcommand{\abgabe}{\marginpar{$\Box$}}
% Margin paragraphs on the left side
\reversemarginpar

% Language for listings
%\lstset{language=Vhdl,
%  basicstyle=\small\tt,
 % keywordstyle=\tt\bf,
 % commentstyle=\sl}

% No indention
\setlength{\parindent}{0.0cm}
% Don't number sections
\setcounter{secnumdepth}{0}


%% Beginning of the text

\begin{document}
\selectlanguage{austrian}
\pagestyle{plain}


%===  This is the header section ============================================================
\thispagestyle{empty}
\noindent
\begin{minipage}[b][4cm]{1.0\textwidth}
\begin{center}
\begin{bf}
\begin{large} Digitale Signalverarbeitung SS 2025/26 -- 4.~Aufgabe\end{large} \\
\vspace{0.3cm}
\begin{Large} Reconstruction, DFT, FFT \end{Large} \\
\vspace{0.3cm}
\end{bf}
\begin{large}
Gruppennummer 211 \\
Manuel Illmayer,  k12308149 \\
Quirin Ecker, k12310122 \\
\end{large}
\end{center}
\end{minipage}

\noindent \rule[0.8em]{\textwidth}{0.12mm}\\[-0.5em]
%=======================================================================================

\begin{aufgabe}{Reconstruction}
	\begin{enumerate}
		\item : \\
			\includegraphics[width=0.8\textwidth]{./fig/fig1.1.png} \\
			\includegraphics[width=0.8\textwidth]{./fig/fig1.2.png}
		\item : \\
			\begin{gather*}
				x(t) = 1 + 0.5 \cos(2\pi f_1 t) + 2 \sin(2\pi f_2 t) + \sin(2\pi f_3 t) \\
			\end{gather*}

			Calculation of $x_1[n]$:

			\begin{gather*}
				x(t) = 1 + 0.5 \cos(2\pi f_1 t) + 2 \sin(2\pi f_2 t) + \sin(2\pi f_3 t) \\
				= 1 + 0.5 \cos(2\pi 2000 t) + 2 \sin(2\pi 4000 t) + \sin(2\pi 6000 t) \\
				x_1[n] = 1 + 0.5 \cos(2\pi \frac{2000}{9000} n) + 2 \sin(2\pi \frac{4000}{9000} n) + \sin(2\pi \frac{6000}{9000} n) \\
				= 1 + 0.5 \cos(\frac{4 \pi}{9} n) + 2 \sin( \frac{8 \pi}{9} n) + \sin( \frac{4 \pi}{3} n) \\
				\\
				\sin(\frac{4 \pi}{3}) = -\sin(\frac{2 \pi}{3})
				\\
				\implies x_1[n]= 1 + 0.5 \cos(\frac{4 \pi}{9} n) + 2 \sin( \frac{8 \pi}{9} n) - \sin( \frac{2 \pi}{3} n)
			\end{gather*}

			Calculation of $x_2[n]$:

			\begin{gather*}
				x_1[n] = 1 + 0.5 \cos(2\pi \frac{2000}{14000} n) + 2 \sin(2\pi \frac{4000}{14000} n) + \sin(2\pi \frac{6000}{14000} n) \\
				= 1 + 0.5 \cos(\frac{2 \pi}{7} n) + 2 \sin( \frac{4 \pi}{7} n) + \sin( \frac{6 \pi}{7} n) \\
			\end{gather*}
			\includegraphics[width=0.8\textwidth]{./fig/fig1.3.png}
		\item: \\

			\[
			f=\frac{\Omega f_s}{2\pi}
			\]

			Calculations for $x_1(t)$:

			\[
			f_1=\frac{\Omega_1 f_s}{2\pi}
			=\frac{\left(\frac{4\pi}{9}\right)9000}{2\pi}
			=2000
			\]

			\[
			f_2 = ... = 4000
			\]

			\[
			f_3=\frac{\Omega_3 f_s}{2\pi}
			=\frac{\left(-\frac{2\pi}{3}\right)9000}{2\pi}
			=-3000
			\]

			Calculations for $x_2(t)$:

			\[
			f_1 = ... = 2000
			\]

			\[
			f_2 = ... = 4000
			\]

			\[
			f_3 = ... = 6000
			\]

			Where '...' is just the formular at the top injected with the $\Omega$ values of b)

			\includegraphics[width=0.8\textwidth]{./fig/fig1.4.png}
	\end{enumerate}
\end{aufgabe}

\begin{aufgabe}{DFT Theory}
	\begin{enumerate}
		\item
			\begin{gather*}
				f_s = \frac{1}{T_s} = \frac{1}{0.001} = 1000 \text{Hz} \\
				\Delta f = \frac{f_s}{N} = \frac{1000}{100} = 10 \text{Hz} \\
			\end{gather*}
		\item
			\begin{gather*}
				\text{In terms of samples}: 100 \\
				\text{In terms of frequency}: N \cdot \Delta f_s = 1000 \text{Hz} \\
				\text{In terms of angular frequency}: \omega = 2 \pi \frac{f}{f_s} = 2 \pi \frac{1000}{1000} = 2 \pi
			\end{gather*}
		\item Computers can calculate it more efficently when it is working with powers of two \\
		\item $\Delta f = \frac{f_s}{N} = \frac{1000}{128} = 7.8125 \text{Hz}$ \\
		\item Even though we have not gained new information, we have a finer resolution of the frequency axis. This can make it easier to get closer to the actual value.
	\end{enumerate}
\end{aufgabe}

\begin{aufgabe}{FFT in Image Processing}
	Approach: We want to remove the low frequencies (high pass filter) to
	keep the areas of the image where the lightness changes relative to
	nearby pixels \\
	\includegraphics[width=0.8\textwidth]{./fig/fig3.1.png}
\end{aufgabe}

\begin{aufgabe}{Window Effects of the DFT}
	\begin{enumerate}
		\item ( see b) )
		\item (see assignment4\_4.m) \\
			\includegraphics[width=0.8\textwidth]{./fig/fig4.1.png}
		\item
Rectangular window: Clear peaks but also many neighbors have fairly high values
Hamming window: Still visible peaks, that may be a bit wider, but now clearly separated from neighbors and more visually readable.
		\item We can choose freqencies that align with our 128 steps, for example f1 = 10/N and f2 = 15/N. With this, the signal fits exactly within our window, each cosine has a integer number of cycles it completes \\
			\includegraphics[width=0.8\textwidth]{./fig/fig4.2.png}
	\end{enumerate}


\end{aufgabe}


\end{document}
