\documentclass[11pt]{article} % Do not change from 11pt type
\usepackage{graphicx,xspace, subcaption}
\usepackage[width=5.5in,height=8in]{geometry}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                             %
%   This template file provides a structure you can use for composing a       %
%   laboratory report. It is made to be compiled with pdflatex, and requires  %
%   the xspace and graphicx packages, which are standard in the basic LaTeX   %
%   distribution.                                                             %
%                                                                             %
%   At the top of the file I define some macros (new commands) and make       %
%   some formatting changes to the default article document style. The        %
%   text of the paper begins below the large comment, and is sprinkled        %
%   with examples of proper formatting and style. For more information on     %
%   LaTeX, see the Mudd LaTeX FAQ at                                          %
%   http://www.cs.hmc.edu/tech_docs/qref/latex/faq/                           %
%                                                                             %
%   Peter N. Saeta                                                            %
%   28 August 2003                                                            %
%   revised 17 March 2008                                                     %
%   revised 2 April 2010                                                      %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\val}[2]{\ensuremath{#1~\mathrm{#2} \xspace}}

\newcommand{\eref}[1]{\ensuremath{\mathrm{Eq.}~(\ref{#1})}}

\newcommand{\singlespace}{\renewcommand{\baselinestretch}{1}\small\normalsize}
\newcommand{\doublespace}{\renewcommand{\baselinestretch}{1.6}\small\normalsize}

\setcounter{secnumdepth}{-2}

\newcommand{\Caption}[1]{\singlespace
\small
\caption{#1}
}

\begin{document}

\begin{center}
	{\LARGE \textbf{Comparison of Frequency-Dependent Signal Attenuation Between Passive and Active High-Pass Filters}}\\[.1in]
	\emph{Aaron Batker Pritzker\\
	Harvey Mudd College\\
	8 December 2013}
\end{center}

\begin{abstract}
	Differences in behavior at different frequency components of a passive and active high-pass filter were studied by Fourier analysis. At a high amplitude that was still well below the active filter's saturation voltage, the active filter introduced massive spikes in amplitude at low even multiples of the input square wave's fundamental frequency. These additional components were most likely due to amplification of noise in the input square wave by the active filter's operational amplifier. They only appeared in the low frequency components because resistive damping in the active filter attenuated the higher-frequency noise.
\end{abstract}


\section{Introduction}

High-pass filters are circuits that ideally leave high frequency signals untouched from input to output and completely block low-frequency signals, or signals with a frequency lower than a specified cutoff. With applications in science, engineering, and consumer products, high-pass filters come in two varieties: passive and active. Passive filters are much simpler circuits, but active filters can amplify their inputs as well as filter them. Of course neither type of filter behaves ideally, and this experiment aims to characterize the differences in behavior of these two types of filter under extreme circumstances. In the world of perfect theory and ideal behavior, there should be no difference between the filters, but what I'm testing is how non-ideal behavior such as signal noise, the complexity of the active filter, and the difference between the first-order passive filter and the second-order active filter affect real-world performance.


\section{Theory}

In theory, both circuits should have the same behavior. This is illustrated by studying the potential at different poins in the following schematics: \newpage
\begin{figure}[h!]
\centering
\Caption{Schematic diagrams of the filters}
\begin{subfigure}{.45\textwidth}
	\centering
	\includegraphics[scale=0.2]{passive.jpg}\\[0.2cm]
	\Caption{Schematic diagram of a passive high-pass filter. Because the bottom rail is tied to ground, $V_{\mathrm{in}}$ is simply the potential of the left side of the top rail and $V_\mathrm{out}$ is the potential of the right side of the top rail. This circuit takes advantage of the fact that a capacitor has very low impedence to high-frequency signals and very high impedence to low-frequency signals.}
	\label{fig:passive}
\end{subfigure}
\begin{subfigure}{0.05\textwidth}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
	\centering
	\includegraphics[scale=0.2]{active.jpg}\\[0.2cm]
	\Caption{Schematic diagram of an active high-pass filter. The triangular object in the middle is an operational amplifier. Both inputs on the left side of the operational amplifier, or op-amp, have essentially infinite impedence, and the output on the right side produces whatever current it can to make the difference between the two inputs close to zero. This circuit takes advantage of the same property of capacitors as the passive filter.}
	\label{fig:active}
\end{subfigure}
\end{figure}
First, let's examine the passive filter. Assuming an alternating current (AC) signal is used as an input, we can say that the impedence of the capacitor is
\begin{equation}
\label{eq:ZC}
Z_C = \frac{1}{2\pi j f C}
\end{equation}
where $j$ is the imaginary unit, $C$ is the capacitor's capacitance, and $f$ is the frequency of the input signal. The impedence of a resistor is simply its resistance. Finding the potential $V_\mathrm{out}$, we know that
\begin{equation}
\label{eq:govPassive}
V_\mathrm{in} - i Z_C = V_\mathrm{out},\;\textrm{and}\;\; V_\mathrm{out} - iR = 0
\end{equation}
Solving the equation on the left for the current $i$ in the circuit and plugging it into the equation on the right, we have a governing equation for this system. Now substituting in for $Z_C$ from Equation~\ref{eq:ZC} and solving for $V_\mathrm{out}$, I find that
\begin{equation}
\label{eq:morePassive}
V_\mathrm{out} = \frac{V_\mathrm{in}}{1 + \frac{1}{2\pi j f R C}}
\end{equation}
Because the input and output signals are periodic, they can be represented as complex exponentials. Therefore the $j$ in the denominator of Equation~\ref{eq:morePassive} indicates a phase shift as well as the expected amplitude change. The most important feature of this equation though is that the amplitude of $V_\mathrm{out}$ decreases as $f$ decreases.

Now let's examine the active filter. Because no current can be drawn by the op-amp's inputs, there is only one value for current ($i$) in the system. The output voltage $V_\mathrm{out}$ must all be dropped across $R_2$ because the op-amp tries to keep both of its inputs at \val{0}{V}. The total input voltage must be dropped over the capacitor and resistor for the same reason. This leads us to the following equations:
\begin{equation}
\label{eq:active}
V_\mathrm{out} = iR_2,\;\;\; V_\mathrm{in} = \frac{i}{j\omega C} + iR_1
\end{equation}
Solving the first equation for $i$, substituting it into the second, and solving for $V_\mathrm{out}$, I find that
\begin{equation}
\label{eq:moreActive}
V_\mathrm{out} = \frac{V_\mathrm{in}}{\frac{1}{R_2 j\omega C} + \frac{R_1}{R_2}}
\end{equation}
Because I chose an $R_1$ and $R_2$ that were equal in resistance to four significant figures, I can call that ratio of resistance 1. After that approximation, the equation for the active and passive filters are identical. The time constant $\tau$ of these filters is $RC$, so because I used a \val{100}{\Omega} resistor and a \val{1}{\mu\mathrm{F}} capacitor, the cutoff frequency should be
\begin{equation}
\label{eq:cutoff}
\frac{1}{2\pi * \tau} = \frac{1}{2\pi R C} = \frac{1}{2 \times \pi \times \val{100}{\Omega} \times \val{1}{\mu\mathrm{F}}} \approx \val{1592}{Hz}
\end{equation}

Although these equations say that the two types of filter should have the same behavior, there are important differences between them. First of all the passive filter has only one energy storage element (the capacitor), and is therefore a first-order system. The active filter has the capacitor that you see and another one in the op-amp. These two capacitors can't be combined into one equivalent capacitor because of a network of diodes in the op-amp, so they are two separate energy storage elements and therefore the active filter is a second-order system. This means that the active filter has the potential to change its output amplitude over a smaller range of frequencies, but it is also vulnerable to the effects of resonance.


\section{Experiment}

The original goal of this experiment was to look for differences in behavior of the two filter types under "extreme circumstances," which could mean one of a few things. Operational amplifiers have several weaknesses, one of which is that they can't produce an output potential that is higher than the potential supplied to them (the "saturation potential"). I intended to stress this aspect of op-amps by increasing the amplitude of the input signal past the saturation potential, but as I was increasing the input signal's amplitude, I started to notice unexpected behavior long before I got to the saturation potential and decided to study that instead.

The experimental setup consisted of the two circuits described in the Figures~\ref{fig:passive} and \ref{fig:active}, supplied with an input square wave with a frequency of \val{187}{Hz} and an amplitude of \val{10}{V}, far below the op-amp's saturation potential of \val{15}{V}. Output voltage was read by an oscilloscope (LabJack U3-HV) sampling at \val{20}{kHz}.


\section{Results}

Let us consider the filters as systems that take input signals $x_p(t)$ and $x_a(t)$ (for passive and active systems respectively) and transform them into output signals $y_p(t)$ and $y_a(t)$. In the frequency domain, these signals are Fourier coefficeints $X_p(j\omega)$, $X_a(j\omega)$, $Y_p(j\omega)$, and $Y_a(j\omega)$. The system (the filter) can be represented by the "transfer function" $H(j\omega)$ such that $Y(j\omega) = H(j\omega) X(j\omega)$. Both sides of this equation can be multiplied by their complex conjugates. Because the Fourier coefficients of a signal multiplied by their complex conjugates constitute the power spectral density (PSD) of the signal, I find that the way the filter affects the magnitude of the input signal is
\begin{equation}
\label{eq:h}
\sqrt{\frac{\mathrm{PSD}_y}{\mathrm{PSD}_x}} = \left|H\right|
\end{equation}
and this applies to both the passive and active signals. Taking the power spectral densities of the input and output, I found that there were large spikes at the odd harmonics (odd multiples of the input signal's fundamental frequency of \val{187}{Hz}), and small spikes at the even harmonics. This means that a large amount of power is carried by the frequency components that are odd multiples of the fundamental frequency, and a small amount of power is carried by the frequency components that are even multiples of the fundamental frequency. Graphing the values of $\left|H\right|$ and fitting an exponential function (the function that fit best), I find the following figures.

\begin{figure}[h!]
\centering
\Caption{Transfer functions for the passive filter}
\begin{subfigure}{.45\textwidth}
	\centering
	\includegraphics[scale=0.25]{passiveOdds.PNG}
	\Caption{Graph of the magnitude of the transfer function of the passive filter on odd multiples of the input wave's fundamental frequency. The fact that the fit function follows the data closely means that the filter doesn't introduce much noise, but because the fit function rises so slowly, this is not a wonderful filter. Fit residuals are shown in the small plot above the main graph.}
	\label{fig:passiveOdds}
\end{subfigure}
\begin{subfigure}{0.05\textwidth}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
	\centering
	\includegraphics[scale=0.25]{passiveEvens.PNG}
	\Caption{Graph of the magnitude of the transfer function of the passive filter on even multiples of the input wave's fundamental frequency. There is a lot more noise in this fucntion because the even multiples of the input wave's fundamental frequency are entirely noise and should not exist at all in a perfect theoretical world. Square waves' power spectra should not contain any amplitude at even multiples of the fundamental frequency.}
	\label{fig:passiveEvens}
\end{subfigure}
\end{figure}

\begin{figure}[h!]
\centering
\Caption{Transfer functions for the active filter}
\begin{subfigure}{.48\textwidth}
	\centering
	\includegraphics[scale=0.25]{activeOdds.PNG}
	\Caption{Graph of the magnitude of the transfer function of the active filter on odd multiples of the input wave's fundamental frequency. This function has a much higher slope around the cutoff frequency than its passive counterpart, but it exhibits both resonance and high amplification of noise. Again, residuals are shown above the main graphs.}
	\label{fig:activeOdds}
\end{subfigure}
\begin{subfigure}{0.04\textwidth}
\end{subfigure}
\begin{subfigure}{.48\textwidth}
	\centering
	\includegraphics[scale=0.25]{activeEvens.PNG}
	\Caption{Graph of the magnitude of the transfer function of the active filter on even multiples of the input wave's fundamental frequency. Here amplification of noise is the dominant factor because even multiples of the input wave's fundamental frequency are so noisy. At high frequencies, the noise is largely damped out by resistance in and outside of the op-amp.}
	\label{fig:activeEvens}
\end{subfigure}
\end{figure}

From these, I can see that the passive filter affects the odd and even harmonics in much the same way, attenuating low frequency components and not attenuating high frequency components. The curve that fits $\left|H\right|$ for the passive filter is a very gently rising exponential though, meaning that the filter does not do an especially good job of blocking all components below the cutoff of \val{1592}{Hz} and transmitting all components above that frequency. The graph of $\left|H\right|$ for the even components is much noisier because they come from noise in the square wave. The power spectral density of a square wave (the input signal) should ideally not contain any even harmonics, but the real input signal did due to noise. This means that the even components were noisier than the odd components, as we can see by the low fit quality. I don't have quantitatve data for the fit quality because the residuals on the plot of $\left|H\right|$ are not distributed even close to normally, so I don't have a way to estimate their standard deviation.

The graph of $\left|H\right|$ for the odd frequency components of the active filter looks better than that of the even filter because the fit function has a much higher maximum slope. This means that the cutoff frequency is a sharper barrier---the active filter does a better job of attenuating signals below a certain frequency and transmitting signals above it. This is because the active filter is a second-order system. This area of high slope though occurs at a lower frequency than the specified cutoff frequency because the active filter exhibits what appears to be resonance right around the cutoff frequency. All second-order systems exhibit a phenomenon called resonance, or the tendency of a system to oscillate at much greater than normal amplitude when driven at a certain frequency called the system's natural frequency. I say that the phenomenon in question appears to be resonance because there is a small region right around the cutoff frequency where the value of $\left|H\right|$ is abnormally high, and there is only one such region.

The graph of $\left|H\right|$ for the even frequency components of the active filter is extremely different from the corresponding passive graph. This is because the active filter is far more sensitive to noise than the passive one. The operational amplifier in the active circuit amplifies the difference between the potentials of its inputs by a very large factor to produce its output. This means that if there is noise in the input signal, it will be magnified immensely by the op-amp and produce a lot of noise in the output signal. The reason this noise appears much more pronounced in the lower frequencies is because it is damped out in the higher frequencies by resistance in the circuit.

The other component of the predicted effects of the filters is a phase shift. Looking at the time domain signals, I looked at the time at which the input signal (square wave) exhibited a dramatic rise, and saw that the output signal exhibited a dramatic rise at exactly the same time, to my measurement resolution of 0.0001 seconds. This tells me that there is no detectable phase shift from input to output in either signal.

\section{Conclusion}

This experiment shows that there are both benefits and drawbacks to using either a passive or active high-pass filter. Passive filters introduce very little if any noise, but the cutoff frequency is not an absolute wall to signals of lower frequency. Because a passive high-pass filter is a first order system, the graph of amplitude attenuation vs frequency has a low maximum slope. Active filters, being second-order systems, solve this problem with higher slopes, but they greatly amplify noise in the input signal. If one wants to use an active filter in any sort of application, I advise that they use either a very low-noise or low-amplitude input signal.

%\singlespace
%\begin{thebibliography}{5in}
%\small
%	\bibitem{Example:2003} P. N. Saeta, \emph{private communcation}, 
%	2003.
%	
%	\bibitem{Resnick:1992} R. Resnick, D. Halliday, and K. S. Krane,
%	Physics, Vol. 1 (Wiley, New York, 1992), pp 12345-12346.
%
%	\bibitem{Quayle}J. D. Quayle, J. Irrepro. Res. \textbf{23}, 1992, 123.
%
%	\bibitem{Quayle2} Ref. \cite{Quayle}, p.\ 126.
%	
%	\bibitem{Carey:2003} M. Carey, ``How to Solve California's Budget 
%	Crisis,'' Los Angeles Times, 28 August 2003, p.\ A23.
%
%\end{thebibliography}
%
%[Do not include references that are not specifically cited with 
%	a numerical endnote in the text.]


\end{document}
