<?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:bib="http://bibtexml.sf.net/" xmlns:m="http://www.w3.org/1998/Math/MathML" id="m10791">

  <name>Nyquist Theorem</name>

  <metadata>
  <md:version>2.5</md:version>
  <md:created>2002/08/06</md:created>
  <md:revised>2006/08/02 14:28:52.411 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="prash">
      <md:firstname>Prashant</md:firstname>
      
      <md:surname>Singh</md:surname>
      <md:email>prash@ece.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="mariyah">
      <md:firstname>Mariyah</md:firstname>
      
      <md:surname>Poonawala</md:surname>
      <md:email>mariyah@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mhutch">
      <md:firstname>Matthew</md:firstname>
      
      <md:surname>Hutchinson</md:surname>
      <md:email>mhutch@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>dsp</md:keyword>
    <md:keyword>nyquist</md:keyword>
    <md:keyword>nyquist frequency</md:keyword>
    <md:keyword>Nyquist theorem</md:keyword>
    <md:keyword>reconstruction</md:keyword>
    <md:keyword>sample</md:keyword>
    <md:keyword>sampling</md:keyword>
  </md:keywordlist>

  <md:abstract>This module introduces the Nyquist theorem.</md:abstract>
</metadata>


  <content>
    <section id="int">
      <name>Introduction</name>
      <para id="p1_int">
	Earlier you should have been exposed to the concepts behind
	<cnxn document="m10798" strength="8">sampling</cnxn> and the
	sampling theorem.  While learning about these ideas, you
	should have begun to notice that if we sample at too low of a
	rate, there is a chance that our original signal will not be
	uniquely defined by our sampled signal.  If this happens, then
	there is no guarantee that we can correctly <cnxn document="m10788" strength="8">reconstruct</cnxn> the signal.
	As a result of this, the <term>Nyquist Theorem</term> was
	created.  Below, we will discuss just what exactly this
	theorem tells us.
      </para>
    </section>


    <section id="sec2">
      <name>Nyquist Theorem</name>
      <para id="para1">
	We will let <m:math><m:ci>T</m:ci></m:math> equal our sampling
	period (distance between samples). Then let
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Ω</m:mi><m:mi>s</m:mi></m:msub>
	    </m:ci>
	    <m:apply>
	      <m:divide/>
	      <m:apply>
		<m:times/>
		<m:cn>2</m:cn>
		<m:pi/>
	      </m:apply>
	      <m:ci>T</m:ci>
	    </m:apply>
	  </m:apply>
	</m:math> (sampling frequency in radians/sec). We have seen
	that if
	<m:math>
	  <m:apply>
	    <m:ci type="fn">f</m:ci>
	    <m:ci>t</m:ci>
	  </m:apply>
	</m:math> is bandlimited to 
	<m:math>
	  <m:interval closure="closed-closed">
	    <m:apply>
	      <m:minus/>
	      <m:ci>
		<m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
	      </m:ci>
	    </m:apply>
	    <m:ci>
	      <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
	    </m:ci>
	  </m:interval>
	</m:math> and we sample with period 
	<m:math>
	  <m:apply>
	    <m:implies/>
	    <m:apply>
	      <m:lt/>
	      <m:ci>T</m:ci>
	      <m:apply>
		<m:divide/>
		<m:pi/>
		<m:ci>
		  <m:msub><m:mi>Ω</m:mi><m:mi>b</m:mi></m:msub>
		</m:ci>
	      </m:apply>
	    </m:apply>
	    <m:apply>
	      <m:implies/>
	      <m:apply>
		<m:lt/>
		<m:apply>
		  <m:divide/>
		  <m:apply>
		    <m:times/>
		    <m:cn>2</m:cn>
		  <m:pi/>
		  </m:apply>
		  <m:ci>
		    <m:msub><m:mi>Ω</m:mi><m:mi>s</m:mi></m:msub>
		  </m:ci>
		</m:apply>
		<m:apply>
		  <m:divide/>
		  <m:pi/>
		  <m:ci>
		    <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
		</m:ci>
		</m:apply>
	      </m:apply>
	      <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:apply>
	  </m:apply>
	</m:math> then we can reconstruct 
	<m:math>
	  <m:apply>
	    <m:ci type="fn">f</m:ci>
	    <m:ci>t</m:ci>
	  </m:apply>
	</m:math> from its samples.
      </para>
      
      <rule id="rule1" type="theorem">
	<name>Nyquist Theorem ("Fundamental Theorem of DSP")</name>
	<statement>
	  <para id="rule1para1">
	    If 
	    <m:math>
	      <m:apply>
		<m:ci type="fn">f</m:ci>
		<m:ci>t</m:ci>
	      </m:apply>
	    </m:math> is bandlimited to 
	    <m:math>
	      <m:interval closure="closed-closed">
		<m:apply>
		  <m:minus/>
		  <m:ci>
		    <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
		  </m:ci>
		</m:apply>
		<m:ci>
		  <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
		</m:ci>
	      </m:interval>
	    </m:math>, we can reconstruct it
	    <emphasis>perfectly</emphasis> from its samples
	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">
		    <m:msub><m:mi>f</m:mi><m:mi>s</m:mi></m:msub>
		  </m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn">f</m:ci>
		  <m:apply>
		    <m:times/>
		    <m:ci>n</m:ci>
		    <m:ci>T</m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math> for 
	    
	    <m:math>
	      <m:apply>
		<m:gt/>
		<m:apply>
		  <m:eq/>
		  <m:ci>
		    <m:msub><m:mi>Ω</m:mi><m:mi>s</m:mi></m:msub>
		  </m:ci>
		  <m:apply>
		    <m:divide/>
		    <m:apply>
		      <m:times/>
		      <m:cn>2</m:cn>
		      <m:pi/>
		    </m:apply>
		    <m:ci>T</m:ci>
		  </m:apply>
		</m:apply>
		<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>
	</statement>
      </rule>

      <para id="para2">
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Ω</m:mi><m:mi>N</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> is called the "<term>Nyquist frequency</term>" for
	
	<m:math>
	  <m:apply>
	    <m:ci type="fn">f</m:ci>
	    <m:ci>t</m:ci>
	  </m:apply>
	</m:math>.  For perfect reconstruction to be possible
	
	<m:math display="block">
	  <m:apply>
	    <m:geq/>
	    <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>
	
	where 
	<m:math>
	  <m:ci>
	    <m:msub><m:mi>Ω</m:mi><m:mi>s</m:mi></m:msub>
	  </m:ci>
	</m:math> is the sampling frequency and 
	<m:math>
	  <m:ci>
	    <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
	  </m:ci>
	</m:math> is the highest frequency in the signal. 

      <figure id="fig1">
	<media type="image/png" src="nyq_f1.png"/>
	<caption>
	  Illustration of Nyquist Frequency
	</caption>		
      </figure> 
    </para>

      <example id="example1">
	<name>Examples:</name>
	<para id="exam1para1">
	  <list id="list1">
	    <item>
	      Human ear hears frequencies up to 20 kHz → CD sample
	      rate is 44.1 kHz.
	    </item>
	    <item>
	      Phone line passes frequencies up to 4 kHz →
	      phone company samples at 8 kHz.
	    </item>
	  </list>
	</para>
      </example>

      <section id="sub1">
	<name>Reconstruction</name>
	<para id="para3">
	  The reconstruction formula in the time domain looks like 

	  <m:math display="block">
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn">f</m:ci>
		<m:ci>t</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar><m:ci>n</m:ci></m:bvar>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">
		      <m:msub><m:mi>f</m:mi><m:mi>s</m:mi></m:msub>
		    </m:ci>
		    <m:ci>n</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:divide/>
		    <m:apply>
		      <m:sin/>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:divide/>
			  <m:pi/>
			  <m:ci>T</m:ci>
			</m:apply>
			<m:apply>
			  <m:minus/>
			  <m:ci>t</m:ci>
			  <m:apply>
			    <m:times/>
			    <m:ci>n</m:ci>
			    <m:ci>T</m:ci>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		    <m:apply>
		      <m:times/>
		      <m:apply>
			<m:divide/>
			<m:pi/>
			<m:ci>T</m:ci>
		      </m:apply>
		      <m:apply>
			<m:minus/>
			<m:ci>t</m:ci>
			<m:apply>
			  <m:times/>
			  <m:ci>n</m:ci>
			  <m:ci>T</m:ci>
			</m:apply>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	  
	  We can conclude, just as before, that 

	  <m:math display="block">
	    <m:apply>
	      <m:forall/>
	      <m:bvar><m:ci>n</m:ci></m:bvar>
	      <m:condition>
		<m:apply>
		  <m:in/>
		  <m:ci>n</m:ci>
		  <m:integers/>
		</m:apply>
	      </m:condition>
	      <m:apply>
		<m:divide/>
		<m:apply>
		  <m:sin/>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:divide/>
		      <m:pi/>
		      <m:ci>T</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:minus/>
		      <m:ci>t</m:ci>
		      <m:apply>
			<m:times/>
			<m:ci>n</m:ci>
			<m:ci>T</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:divide/>
		    <m:pi/>
		    <m:ci>T</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:minus/>
		    <m:ci>t</m:ci>
		    <m:apply>
		      <m:times/>
		      <m:ci>n</m:ci>
		      <m:ci>T</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>

	  is a <cnxn document="m10734" strength="8">basis</cnxn> for the
	  space of
	  <m:math>
	    <m:interval closure="closed-closed">
	      <m:apply>
		<m:minus/>
		<m:ci>
		  <m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
		</m:ci>
	      </m:apply>
	      <m:ci>
		<m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
	      </m:ci>
	    </m:interval>
	  </m:math> bandlimited functions, 
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:ci>
		<m:msub><m:mi>Ω</m:mi><m:mi>B</m:mi></m:msub>
	      </m:ci>
	      <m:apply>
		<m:divide/>
		<m:pi/>
		<m:ci>T</m:ci>
	      </m:apply>
	    </m:apply>
	  </m:math>. The expansion coefficient for this basis are
	  calculated by sampling 
	  <m:math>
	    <m:apply>
	      <m:ci type="fn">f</m:ci>
	      <m:ci>t</m:ci>
	    </m:apply>
	  </m:math> at rate 
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:divide/>
		<m:apply>
		  <m:times/>
		  <m:cn>2</m:cn>
		  <m:pi/>
		</m:apply>
		<m:ci>T</m:ci>
	      </m:apply>
	      <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>. 

	  <note type="note">The basis is also orthogonal. To make it
	    <cnxn document="m10760" strength="6">orthonormal</cnxn>, we
	    need a normalization factor of
	    <m:math>
	      <m:apply>
		<m:root/>
		<m:ci>T</m:ci>
	      </m:apply>
	    </m:math>.
	  </note> 
	</para>
      </section>
      
      <section id="sub2">
	<name>The Big Question</name>
	<exercise id="exe1">
	  <problem>
	    <para id="exe1para1">
	      What if 
	      <m:math>
		<m:apply>
		  <m:lt/>
		  <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>? What happens when we sample below the Nyquist rate?
	    </para>
	  </problem>
	  <solution>
	    <para id="exe1para2">
	      Go through the steps: (see <cnxn target="fig2"/>)
	    </para>
	    
	    <figure id="fig2">
	      <media type="image/png" src="nyq_f2.png"/>
	      <caption/>
	    </figure> 

	    <para id="lastpara">
	      Finally, what will happen to 
	      <m:math>
		<m:apply>
		  <m:ci type="fn">
		    <m:msub>
		      <m:mi>F</m:mi>
		      <m:mi>s</m:mi>
		    </m:msub>
		  </m:ci>
		  <m:apply>
		    <m:exp/>
		    <m:apply>
		      <m:times/>
		      <m:imaginaryi/>
		      <m:ci>ω</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:math> now?  To answer this final question, we will now
	      need to look into the concept of <cnxn document="m10793" strength="9">aliasing</cnxn>. 
	    </para>
	  </solution>
	</exercise>
      


</section><para id="element-281"><media type="application/x-labviewrpvi80" src="NyquistPlot.llb">
		<param name="lvfppviname" value="Nyquist Plot of a Filter.vi"/>
		<param name="width" value="770"/>
		<param name="height" value="550"/>
	</media></para>
    </section>

  </content>  
</document>
