\documentclass[report]{IEEEtran}

\usepackage{graphicx}
\usepackage{listings}
\usepackage{xcolor}

\lstdefinestyle{codestyle}{
    commentstyle=\color{green},
    keywordstyle=\color{blue},
    numberstyle=\tiny\color{gray},
    stringstyle=\color{purple},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

\lstset{style=codestyle}

\title{Linear and Time Invariant Systems}

\author{Aidan Sharpe \& Elise Heim}

\begin{document}
\maketitle

\begin{abstract}
    This lab includes finding a transfer function and using the impulse response as part of functions built into the symbolic math toolbox. It also entails using convolutions so recognize how the shape of a function is modified by the shape of another function. It also involves completing Laplace and inverse Laplace transformations upon functions. And finally, it includes experimenting with Linear Prediction of Speech, and how to sample and exploring different features of speech audio clips.
\end{abstract}

\section{Introduction \& Objectives}
An important purpose of this lab is becoming familiar with the symbolic math toolbox on MATLAB. This is beneficial because it includes functions such as impulse and convolution, which can be difficult to program by oneself. This toolbox is advantageous for the first two questions of the lab in particular. Another key takeaway includes learning how to compute a Laplace Transformation and an Inverse Laplace Transformation in MATLAB. This can be very helpful, because more complicated functions can be more difficult to perform such transformations. Another objective of this lab is learning how to analyze a speech signal. This includes investigating features such as the periodicity, pitch, and phoneme, and sampling the speech signal at regular intervals to get an accurate understanding. 

\section{Background}
This lab includes using the symbolic math toolbox and its functions. One of which is the \verb|impulse| function. An impulse is a brief impulse signal, and an impulse response is the output. Another such function is \verb|conv|, for convolutions. A convolution is an operation that produces a function that expresses how the shape of one is modified by the other. One more function is \verb|tf|, for transfer function. This is the representation of the relationship between the input and output of a system. Yet another helpful function, while not in the toolbox, is the unit step, which  is defined as a function wherein the value is equal to 0 when time is less than 0, and 1 when time is greater than 0. It looks similar to a step, as its name suggests. It is often referred to as $u(t)$.

\section{Results \& Discussion}
There were four focal points to this lab: transfer functions and impulse response, convolutions, Laplace transforms and inverse Laplace transforms, and attempting linear prediction of speech.

\subsection{Transfer Functions and Impulse Response}
The transfer function of a linear, time-invariant system, $H(s)$ was plotted in the complex plane, and as shown in figure \ref{fig:pzplot}, the system has zeros at -3 and -2 and the poles at $-5\pm j5$, -1, and 0. Zeroes are the inputs where the output value is zero, typically plotted as a circle. Poles on the other hand exist at the inputs where the output value is undefined and are typically plotted with an "x" marker.

$$H(s) = {s^2 + 5s + 6 \over s(s + 1)(s^2 + 10s + 50)$$

\begin{figure}[h]
    \caption{Plot of poles and zeros of $H(s)$}
    \includegraphics[width=0.48\textwidth]{pzmap.png}
    \label{fig:pzplot}
\end{figure}

The impulse response of the system can be created using the \verb|impulse()| function. Given that the initial value theorem shown in equation \ref{eqn:init-val-thm}, we can calculate h(0). Evaluating the limit gives an initial value of $h(0) = 0$. This reflects the plot of the impulse response. In a similar manner, the final value theorem, as seen in \ref{eqn:fin-val-thm}, also invokes a limit to evaluate the impulse response at an extreme input, in this case, $t = \infty$. Through this theorem, we can calculate the steady-state value of $h(t)$. When $s$ goes to 0, only constants remain, and value goes to $3 \over 25$ in the limit. The plot of the impulse response is again in agreement with predictions, with the plot levelling off at a value approaching 0.12.

\begin{figure}[h]
    \caption{The impulse response of $H(s)$}
    \includegraphics[width=0.48\textwidth]{ImpulseResponse.png}
    \label{fig:impulse-response}
\end{figure}

\begin{equation}
    h(0) = \lim_{s \to \infty} sH(s)
    \label{eqn:init-val-thm}
\end{equation}

\begin{equation}
    \lim_{t \to \infty} h(t) = \lim_{s \to 0} sH(s)
    \label{eqn:fin-val-thm}
\end{equation}

The next step includes using an inverse Laplace function in order to find the impulse response of the system. This was accomplished with the \verb|ilaplace()| function. By applying this function to the system, $H(s)$, the impulse response was found to be $h(t)$, shown below.

$$h(t) = u(t)\left[{123 \over 1025} - {2 \over 41}e^{-t} + {122 \over 1025}\sin(5t)e^{-5t} - {73 \over 1025}\cos(5t)e^{-5t}\right]$$

\subsection{Impulse Response-Based System Analysis}
In this part, the LTI system with the impulse response, $h(t)$ (shown below) was used for analysis. For an linear, time-invariant system, if the impulse response is causal---that is for all inputs where $t<0$, the value is 0---then the entire system is said to be causal---that is no output depends on future inputs.

$$h(t) = u(t) - u(t-1)$$

In this case, since the value of $h(t)$ is 0 for all $t < 0$, the LTI system it is the impulse response of is said to be causal.

For the system with impulse response, $h(t)$, to be considered BIBO stable, the area under the impulse response curve must be bounded. The rigorous definition for BIBO stability is seen in equation, \ref{eqn:LTI-BIBO}. Since the integral can be simplified as a finite area of a rectangle under the difference of two unit steps, the system was determined to be BIBO stable.

\begin{equation}
    \int\limits_{-\infty}^{\infty} |h(t)|dt < \infty
    \label{eqn:LTI-BIBO}
\end{equation}

To find the response of an arbitrary signal, $x(t)$, into an LTI system, it is simply the convolution of the impulse response with the signal. This can be done by evaluating the integral described by equation \ref{eqn:convolution-impulse}.

\begin{equation}
    y(t) = x(t)*h(t) = \int x(\tau) h(t - \tau)d\tau
    \label{eqn:convolution-impulse}
\end{equation}

Given this process to arrive at the response of an arbitrary signal, we can determine the response of the signal, $x(t)$, shown below.

$$x(t) = e^{-2t}u(t)$$


\subsection{Laplace Transforms and Inverse Laplace Transforms}
This part consisted of evaluating the Laplace transform of a real exponential modulated by a cosine. The signal and its Laplace transform are seen below.

$$x(t) = e^{-t}\cos(10t)u(t)$$
$$X(s) = \mathcal{L}\{x(t)\}(s) = {s + 1 \over s^2 + 2s + 101}$$

Plotting $X(s)$ for its poles and zeros yields the pole-zero map shown in figure \ref{fig:part-3-pzmap}.

\begin{figure}
    \caption{Pole-Zero map for $X(s)$}
    \includegraphics[width=0.48\textwidth]{pzmap2.png}
    \label{fig:part-3-pzmap}
\end{figure}

$$X(s) = {2s + 3 \over s^2 + 2s + 4}$$
$$x(t) = \mathcal{L}^{-1}\{X(s)\}(t) = {\sqrt{3} \over 3} \sin(\sqrt{3} t) e^{-t} + 2\cos(\sqrt{3} t)e^{-t}$$

Plotting the impulse response, $x(t)$, yields the time domain function shown in figure \ref{fig:part-3-impulse}.

\begin{figure}
    \caption{Impulse response of $X(s)$}
    \includegraphics[width=0.48\textwidth]{part-3-impulse.png}
    \label{fig:part-3-impulse}
\end{figure}

\section{Conclusion}
Through the course of this lab, one can become very familiar with the symbolic math toolbox that MATLAB offers. Using the functions for impulse, convolutions, transfer functions, Laplace, and inverse Laplace transformations greatly assist with completing such exercises. These tools will prove to be helpful in the future when working with LTI systems in the wild. Since RL, RC, and RLC circuits can all be modeled as LTI systems, knowing how to use these tools will make working with and designing these types of circuits much easier in the future.

\end{document}
