\documentclass{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[margin=1in]{geometry}


\title{Discrete Fourier Transforms and Z-Transforms}

\author{Aidan Sharpe \& Elise Heim}

\DeclareMathOperator{\sinc}{sinc}

\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}

\section{Results \& Discussion}

\subsection{The Discrete Fourier Transform (DFT)}
Given a signal, $x[n]$, it's $N$-point DFT is given by
\begin{equation}
	X_k = \sum_{n=0}^{N-1} x[n] W_N^{kn},
	\label{eqn:DFT_def}
\end{equation}
where $W_N = e^{-j2\pi/N}$. The discrete Fourier transform is the sampled version of the discrete time Fourier transform (DTFT), which is a continuous function. More specifically, the $N$-point DFT contains $N$ samples from the continuous DTFT.
\\
\\
For example, consider the signal $x[n] = (-1)^n$ for $0 \le n \le N-1$. By evaluating the sum shown in equation \ref{eqn:DFT_def} as a truncated geometric series, the $N$-point DFT of $x[n]$ can be found. All truncated geometric series are evaluated as
\begin{equation}
    \sum_{k=0}^{n-1} a r^k = 
    \begin{cases}
        an & r = 1 \\
        a\left({1 - r^n \over 1 - r}\right) & r \ne 1
    \end{cases},
\end{equation}
where $r$ is the common ratio between adjacent terms. For the $N$-point DFT of $x[n]$, the common ratio is $-W_N^k$, which takes a value of 1 for $k = {N\over2}$. Therefore, the $N$-point DFT of $x[n]$ is
\begin{equation}
    X[k] = \begin{cases}
        N & k = {N \over 2} \\
        \left({1 - (-W_N^k)^N \over 1 - (-W_N^k)}\right) & k \ne {N \over 2}
    \end{cases}.
    \label{eqn:DFT_N_point}
\end{equation}
The $N$-point DFT of $x[n]$, where $N=8$ is seen in figure \ref{fig:N_point_DFT}. It only has a non-zero value for $k={N\over2}=4$. This is the case for all even-number-point DFTs. Therefore, only odd-number-point DFTs should be used.
\begin{figure}[H]
    \center
    \includegraphics[width=0.5\textwidth]{N8_point_DFT.png}
    \caption{The $N$-point DFT of $x[n]$, where $N=8$}
    \label{fig:N_point_DFT}
\end{figure}
For example, the 9-point DFT of $x[n]$, where $N=8$ is seen in figure \ref{fig:9_point_DFT}. While  equation \ref{eqn:DFT_N_point} cannot be used because there are a different number of samples for the DFT and the input signal, the overall DFT is more useful than the 8-point DFT.
\begin{figure}[H]
	\center
    \includegraphics[width=0.5\textwidth]{Q9_point_DFT.png}
	\caption{The 9-point DFT of $x[n]$, where $N=8$}
    \label{fig:9_point_DFT}
\end{figure}


\subsection{The Z-Transform}
Given a discrete signal, $x[n]$, its z-transform is given by
\begin{equation}
	X(z) = \sum_n x[n] z^{-n}
\end{equation}
where $z$ is a complex variable. The Z-transform of any discrete signal is a continuous function. Therefore, any attempt to calculate the Z-transform with a digital computer requires sampling or symbolic math. Symbolic math is quite a powerful tool, and others have worked hard to implement the Z-transform as a symbolic function. In MATLAB, this function is \verb|ztrans|. 
\\
\\
The Z-transform of the following signals can be found very quickly using this method:
$$x_1[n] = a^n u[n]$$
$$x_2[n] = (n+1)a^n u[n]$$
$$x_3[n] = a^n \cos(bn) u[n]$$
$$\mathcal{Z}\{x_1[n]\} = -{z \over a - z}$$
$$\mathcal{Z}\{x_2[n]\} = {az \over (a - z)^2} - {z \over a - 2}$$
$$\mathcal{Z}\{x_3[n]\} = -{z(\cos(b) - z/a) \over a{z^2\over a^2} - {2z\cos(b) \over a} + 1}$$

\subsection{The Inverse Z-Transform}
Similarly, the inverse Z-transform also benefits from using a symbolic calculator. For example, the inverse Z-transform of the following can be found rapidly:
$$\mathcal{Z}\{x_4[n]\} = {z \over z + 0.5}$$
$$\mathcal{Z}\{x_5[n]\} = {z^2 \over (z-0.8)^2}$$
$$\mathcal{Z}\{x_6[n]\} = {z \over (z+0.3)(z+0.6)^2}$$
$$x_4[n] = (-1/2)^n$$
$$x_5[n] = 2(4/5)^n (n-1)(4/5)^n$$
$$x_6[n] = {50n(-3/5)^n - 100(-3/5)^n + 100(-3/10)^n \over 9}$$


\section{Conclusions}
Overall understanding tricks for calculating geometric sums is very helpful for calculating DFTs. It is also important to use odd-number-point DFTs only, as taking an even number of samples forces almost all values to go to zero. As for Z-transforms and inverse Z-transforms, knowing how to use symbolic computation makes finding them quite easy. Additionally, symbolic computation allows for the easy manipulation of how simplified or expanded the result is.
\end{document}
