<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m10794">

  <name>Anti-Aliasing Filters</name>

  <metadata>
  <md:version>2.3</md:version>
  <md:created>2002/08/07</md:created>
  <md:revised>2003/07/09 14:05:19 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="jrom">
      <md:firstname>Justin</md:firstname>
      
      <md:surname>Romberg</md:surname>
      <md:email>jrom@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="march">
      <md:firstname>Marc</md:firstname>
      
      <md:surname>Hernandez</md:surname>
      <md:email>cramzednanreh@yahoo.com</md:email>
    </md:maintainer>
    <md:maintainer id="jrom">
      <md:firstname>Justin</md:firstname>
      
      <md:surname>Romberg</md:surname>
      <md:email>jrom@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="richb">
      <md:firstname>Richard</md:firstname>
      <md:othername>G.</md:othername>
      <md:surname>Baraniuk</md:surname>
      <md:email>richb@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mjhaag">
      <md:firstname>Michael</md:firstname>
      
      <md:surname>Haag</md:surname>
      <md:email>mjhaag@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mariyah">
      <md:firstname>Mariyah</md:firstname>
      
      <md:surname>Poonawala</md:surname>
      <md:email>mariyah@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="prash">
      <md:firstname>Prashant</md:firstname>
      
      <md:surname>Singh</md:surname>
      <md:email>prash@ece.rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>alias</md:keyword>
    <md:keyword>aliasing</md:keyword>
    <md:keyword>Anti-Aliasing</md:keyword>
    <md:keyword>filter</md:keyword>
    <md:keyword>sampling</md:keyword>
  </md:keywordlist>

  <md:abstract>This module discusses Anti-Aliasing and provides examples of filters that can be used to avoid aliasing.</md:abstract>
</metadata>


  <content>
    <section id="sec1">
      <name>Introduction</name>
      <para id="para1">
	The idea of <cnxn document="m10793" strength="8">aliasing</cnxn>
	has been described as the problem that occurs if a signal is
	not <cnxn document="m10798" strength="8">sampled</cnxn> at a
	high enough rate (for example, below the <cnxn document="m10791" strength="7">Nyquist Frequency</cnxn>).  But exactly what kind
	of distortion does aliasing produce?
      </para>

      <figure orient="vertical" id="fig1">
	<subfigure id="subf1">
	  <media type="image/png" src="anti1.png"/>
	  <caption>

	  </caption>
	</subfigure>
	<subfigure id="subf2">
	  <media type="image/png" src="anti2.png"/>
	  <caption>

	  </caption>
	</subfigure>
      </figure>

      <para id="afterfigs">
	High frequencies in the original signal "fold back" into lower
	frequencies. 
      </para>
      
      <para id="para2">
	High frequencies masquerading as lower frequencies produces
	<emphasis>highly undesirable</emphasis> artifacts in the
	reconstructed signal.
	<note type="warning">We must avoid aliasing anyway we can.</note>
      </para>
    </section>
    
    <section id="sec2">
      <name>Avoiding Aliasing</name>
      <para id="para3">
	What if it is impractical/impossible to sample at 
	<m:math>
	  <m:apply>
	    <m:gt/>
	    <m:ci>
	      <m:msub>
		<m:mi>Ω</m:mi>
		<m:mi>s</m:mi>
	      </m:msub>
	    </m:ci>
	    <m:apply>
	      <m:times/>
	      <m:cn>2</m:cn>
	      <m:ci>
		<m:msub>
		  <m:mi>Ω</m:mi>
		  <m:mi>B</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	  </m:apply>
	</m:math>?
      </para>

      <para id="para4">
	Filter out the frequencies above 
	<m:math>
	  <m:apply>
	    <m:divide/>
	    <m:ci>
	      <m:msub>
		<m:mi>Ω</m:mi>
		<m:mi>s</m:mi>
	      </m:msub>
	    </m:ci>
	    <m:cn>2</m:cn>
	  </m:apply>
	</m:math> <emphasis>before</emphasis> you sample.  The best
	way to visualize doing this is to imagine the following simple
	steps:

	<list id="samp_steps" type="enumerated">
	  <item>
	    Take the CTFT of the signal, 
	    <m:math>
	      <m:apply>
		<m:ci type="fn">f</m:ci>
		<m:ci>t</m:ci>
	      </m:apply>
	    </m:math>.
	  </item>
	  <item>
	    Send this signal through a lowpass filter with the
	    following specification, 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:ci><m:msub>
		  <m:mi>ω</m:mi>
		  <m:mi>c</m:mi>
		</m:msub></m:ci>
		<m:apply>
		  <m:divide/>
		  <m:ci><m:msub>
		    <m:mi>Ω</m:mi>
		    <m:mi>s</m:mi>
		  </m:msub></m:ci>
		  <m:cn>2</m:cn>
		</m:apply>
	      </m:apply>
	    </m:math>.
	  </item>
	  <item>
	    We now have a graph of our signal in the frequency domain
	    with all values of 
	    <m:math>
	      <m:apply>
		<m:gt/>
		<m:apply>
		  <m:abs/>
		  <m:ci>ω</m:ci>
		</m:apply>
		<m:apply>
		  <m:divide/>
		  <m:ci><m:msub>
		    <m:mi>Ω</m:mi>
		    <m:mi>s</m:mi>
		  </m:msub></m:ci>
		  <m:cn>2</m:cn>
		</m:apply>
	      </m:apply>
	    </m:math> equal to zero.  Now, we take the inverse CTFT to
	    get back our continuous time signal,
	    <m:math>
	      <m:apply>
		<m:ci type="fn">
		  <m:msub>
		    <m:mi>f</m:mi>
		    <m:mi>a</m:mi>
		  </m:msub>
		</m:ci>
		<m:ci>t</m:ci>
	      </m:apply>
	    </m:math>.
	  </item>
	  <item>
	    And finally we are ready to sample our signal!
	  </item>
	</list>

      </para>

      <!-- fig graph -->

      <example id="expl">
	<para id="exp1">
	  Sample rate for 
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:ci>CD</m:ci>
	      <m:apply>
		<m:times/>
		<m:cn type="real">44.1</m:cn>
		<m:ci>KHz</m:ci>
	      </m:apply>
	    </m:apply>
	  </m:math>. 
	</para>

	<para id="exp2">
	  Many musical instruments (<foreign>e.g.</foreign> highhat)
	  contain frequencies above 
  <m:math>
    <m:apply>
      <m:times/><m:cn>22</m:cn>
      <m:ci>KHz</m:ci>
    </m:apply>
  </m:math>
	   (even though we cannot hear them).
	</para>

	<para id="exp3">
	  Because of this, we can filter the output signal from the
	  instrument before we sample it using the following filter:
	
	<figure id="fig3">
	  <media type="image/png" src="anti3.png"/>
	  <caption>
	    This filter will cutoff the higher, unnecessary
	    frequencies, where 
	    <m:math>
	      <m:apply>
		<m:gt/>
		<m:apply>
		  <m:abs/>
		  <m:ci><m:msub>
		    <m:mi>ω</m:mi>
		    <m:mi>c</m:mi>
		  </m:msub></m:ci>
		</m:apply>
		<m:apply>
		  <m:times/>
		  <m:cn>2</m:cn>
		  <m:pi/>
		  <m:cn>22</m:cn>
	    <m:ci>kHz</m:ci>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </caption>
	</figure>
	</para>

	<para id="exp4">
	  Now the signal is ready to be sampled!
	</para>
      </example>


      <example id="exmpl2">
	<name>Another Example</name>
	<para id="exp21">
	  Speech bandwidth is 
	  <m:math>
	    <m:apply>
	      <m:gt/>
	      <m:apply>
		<m:ci><m:mo>±</m:mo></m:ci>
		<m:apply>
		  <m:times/>
		<m:cn>20</m:cn>
	      <m:ci>kHz</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>, but it is perfectly intelligible when
	  lowpass filtered to a 
      <m:math>
	<m:apply>
	  <m:ci><m:mo>±</m:mo></m:ci>
	  <m:apply>
	    <m:times/>
	    <m:cn>4</m:cn>
	    <m:ci>kHz</m:ci>
	  </m:apply>
	</m:apply>
      </m:math> range.  Because of this, we can take a normal
	  speech signal and pass it through a filter like the one
	  shown in <cnxn target="fig3" strength="8"/>, where we now set 
	  <m:math>
	    <m:apply>
	      <m:gt/>
	      <m:apply>
		<m:abs/>
		<m:msub>
		  <m:mi>ω</m:mi>
		  <m:mi>c</m:mi>
		</m:msub>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:cn>2</m:cn>
		<m:pi/>
		<m:cn>4</m:cn>
		  <m:ci>kHz</m:ci>
	      </m:apply>
	    </m:apply>
	  </m:math>.  The signal we receive from this filter only
	  contains values where 
	  <m:math>
	    <m:apply>
	      <m:gt/>
	      <m:apply>
		<m:abs/>
		<m:ci>ω</m:ci>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:cn>8</m:cn>
		<m:pi/>
		<m:ci>k</m:ci>
	      </m:apply>
	    </m:apply>
	  </m:math>.
	</para>

	<!-- figure -->

	<!-- figure -->

	<!-- figure -->

	<para id="exp22">
	  Now we can sample at 
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:times/>
		<m:cn>16</m:cn>
		<m:pi/>
		<m:ci>k</m:ci>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:cn>8</m:cn>
		  <m:ci>kHz</m:ci>
	      </m:apply>
	    </m:apply>
	  </m:math> -- standard telephony rate.
	</para>
      </example>

    </section>
  </content>  
</document>
