<?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="m10786">

  <name>Circular Convolution and the DFT</name>

  <metadata>
  <md:version>2.8</md:version>
  <md:created>2002/08/05</md:created>
  <md:revised>2006/07/19 16:36:10.498 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="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>circular</md:keyword>
    <md:keyword>circular convolution</md:keyword>
    <md:keyword>convolution</md:keyword>
    <md:keyword>convolutions</md:keyword>
    <md:keyword>convolve</md:keyword>
    <md:keyword>dft</md:keyword>
    <md:keyword>discrete fourier transform</md:keyword>
    <md:keyword>fourier transform</md:keyword>
    <md:keyword>system</md:keyword>
  </md:keywordlist>

  <md:abstract>This module describes the circular convolution algorithm and an alternative algorithm</md:abstract>
</metadata>

  <content>
    <section id="intro">
      <name>Introduction</name>
      <para id="p1_intro">
	You should be familiar with <cnxn document="m10087" strength="8">Discrete-Time Convolution</cnxn>, which tells us
	that given two discrete-time signals 
	<m:math display="inline">
	  <m:apply>
	    <m:ci type="fn" class="discrete">x</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>, the system's input, and 
	<m:math display="inline">
	  <m:apply>
	    <m:ci type="fn" class="discrete">h</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>, the system's response, we define the output of the
	system as

	<equation id="eq_csum">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#convolve"/>
		<m:apply>
		  <m:ci type="fn" class="discrete">x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</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">x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:apply>
		      <m:minus/>
		      <m:ci>n</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
	
	When we are given two DFTs (finite-length sequences usually of
	length <m:math><m:ci>N</m:ci></m:math>), we cannot just
	multiply them together as we do in the above convolution
	formula, often referred to as <term>linear convolution</term>.
	Because the DFTs are periodic, they have nonzero values for
	<m:math>
	  <m:apply>
	    <m:geq/>
	    <m:ci>n</m:ci>
	    <m:ci>N</m:ci>
	  </m:apply>
	</m:math> and thus the multiplication of these two DFTs will
	be nonzero for 
	<m:math>
	  <m:apply>
	    <m:geq/>
	    <m:ci>n</m:ci>
	    <m:ci>N</m:ci>
	  </m:apply>
	</m:math>.  We need to define a new type of convolution
	operation that will result in our convolved signal being zero
	outside of the range 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>n</m:ci>
	    <m:set>
	      <m:cn>0</m:cn>
	      <m:cn>1</m:cn>
	      <m:ci>…</m:ci>
	      <m:apply>
		<m:minus/>
		<m:ci>N</m:ci>
		<m:cn>1</m:cn>
	      </m:apply>
	    </m:set>
	  </m:apply>
	</m:math>.  This idea led to the development of <term>circular
	convolution</term>, also called cyclic or periodic convolution. 
      </para>
    </section>

    <section id="sec2">
      <name>Circular Convolution Formula</name>
      <para id="para1">
	What happens when we multiply two DFT's together, where 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">Y</m:ci>
	    <m:ci>k</m:ci>
	  </m:apply>
	</m:math> is the DFT of 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">y</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>?

	<equation id="eqa">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="function" class="discrete">Y</m:ci>
		<m:ci>k</m:ci>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:ci type="function" class="discrete">F</m:ci>
		  <m:ci>k</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="function" class="discrete">H</m:ci>
		  <m:ci>k</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math> 
	</equation>

	when 
	<m:math>
	  <m:apply>
	    <m:leq/>
	    <m:cn>0</m:cn>
	    <m:ci>k</m:ci>
	    <m:apply>
	      <m:minus/>
	      <m:ci>N</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	  </m:apply>
	</m:math>
      </para>

      <para id="para2">
	Using the DFT synthesis formula for 
	<m:math>
	  <m:apply>
	    <m:ci type="function" class="discrete">y</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>

	<equation id="eq2">
	  <m:math display="block">
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="function" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:divide/>
		  <m:cn>1</m:cn>
		  <m:ci>N</m:ci>
		</m:apply>
		<m:apply>
		  <m:sum/>
		  <m:bvar>
		    <m:ci>k</m:ci>
		  </m:bvar>
		  <m:lowlimit>
		    <m:cn>0</m:cn>
		  </m:lowlimit>
		  <m:uplimit>
		    <m:apply>
		      <m:minus/>
		      <m:ci>N</m:ci>
		      <m:cn>1</m:cn>
		    </m:apply>
		  </m:uplimit>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci type="function" class="discrete">F</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci type="function" class="discrete">H</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:power/>
		      <m:exponentiale/>
		      <m:apply>
			<m:times/>
			<m:ci>j</m:ci>
			<m:apply>
			  <m:divide/>
			  <m:apply>
			    <m:times/>
			    <m:cn>2</m:cn>
			    <m:pi/>
			  </m:apply>
			  <m:ci>N</m:ci>
			</m:apply>
			<m:ci>k</m:ci>
			<m:ci>n</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
      </para>

      <para id="para3">
	And then applying the analysis formula
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci type="function" class="discrete">F</m:ci>
	      <m:ci>k</m:ci>
	    </m:apply>
	    <m:apply>
	      <m:sum/>
	      <m:bvar>
		<m:ci>m</m:ci>
	      </m:bvar>
	      <m:lowlimit>
		<m:cn>0</m:cn>
	      </m:lowlimit>
	      <m:uplimit>
		<m:apply>
		  <m:minus/>
		  <m:ci>N</m:ci>
		  <m:cn>1</m:cn>
		</m:apply>
	      </m:uplimit>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:ci type="function" class="discrete">f</m:ci>
		  <m:ci>m</m:ci>
		</m:apply>
		<m:apply>
		  <m:power/>
		  <m:exponentiale/>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:minus/>
		      <m:ci>j</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:divide/>
		      <m:apply>
			<m:times/>
			<m:cn>2</m:cn>
			<m:pi/>
		      </m:apply>
		      <m:ci>N</m:ci>
		    </m:apply>
		    <m:ci>k</m:ci>
		    <m:ci>n</m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:apply>
	</m:math>

	<equation id="eq3">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="function" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:divide/>
		  <m:cn>1</m:cn>
		  <m:ci>N</m:ci>
		</m:apply>
		<m:apply>
		  <m:sum/>
		  <m:bvar>
		    <m:ci>k</m:ci>
		  </m:bvar>
		  <m:lowlimit>
		    <m:cn>0</m:cn>
		  </m:lowlimit>
		  <m:uplimit>
		    <m:apply>
		      <m:minus/>
		      <m:ci>N</m:ci>
		      <m:cn>1</m:cn>
		    </m:apply>
		  </m:uplimit>
		  <m:apply>
		    <m:times/>		    
		    <m:apply>
		      <m:sum/>
		      <m:bvar>
			<m:ci>m</m:ci>
		      </m:bvar>
		      <m:lowlimit>
			<m:cn>0</m:cn>
		      </m:lowlimit>
		      <m:uplimit>
			<m:apply>
			  <m:minus/>
			  <m:ci>N</m:ci>
			  <m:cn>1</m:cn>
			</m:apply>
		      </m:uplimit>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:ci type="function" class="discrete">f</m:ci>
			  <m:ci>m</m:ci>
			</m:apply>
			<m:apply>
			  <m:power/>
			  <m:exponentiale/>
			  <m:apply>
			    <m:times/>
			    <m:apply>
			      <m:minus/>
			      <m:ci>j</m:ci>
			    </m:apply>
			    <m:apply>
			      <m:divide/>
			      <m:apply>
				<m:times/>
				<m:cn>2</m:cn>
				<m:pi/>
			      </m:apply>
			      <m:ci>N</m:ci>
			    </m:apply>
			    <m:ci>k</m:ci>
			    <m:ci>n</m:ci>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		    <m:apply>
		      <m:ci type="function" class="discrete">H</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:power/>
		      <m:exponentiale/>
		      <m:apply>
			<m:times/>
			<m:ci>j</m:ci>
			<m:apply>
			  <m:divide/>
			  <m:apply>
			    <m:times/>
			    <m:cn>2</m:cn>
			    <m:pi/>
			  </m:apply>
			  <m:ci>N</m:ci>
			</m:apply>
			<m:ci>k</m:ci>
			<m:ci>n</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>m</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:cn>0</m:cn>
		</m:lowlimit>
		<m:uplimit>
		  <m:apply>
		    <m:minus/>
		    <m:ci>N</m:ci>
		    <m:cn>1</m:cn>
		  </m:apply>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">f</m:ci>
		    <m:ci>m</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:divide/>
		      <m:cn>1</m:cn>
		      <m:ci>N</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:sum/>
		      <m:bvar>
			<m:ci>k</m:ci>
		      </m:bvar>
		      <m:lowlimit>
			<m:cn>0</m:cn>
		      </m:lowlimit>
		      <m:uplimit>
			<m:apply>
			  <m:minus/>
			  <m:ci>N</m:ci>
			  <m:cn>1</m:cn>
			</m:apply>
		      </m:uplimit>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:ci type="fn" class="discrete">H</m:ci>
			  <m:ci>k</m:ci>
			</m:apply>
			<m:apply>
			  <m:power/>
			  <m:exponentiale/>
			  <m:apply>
			    <m:times/>
			    <m:ci>j</m:ci>
			    <m:apply>
			      <m:divide/>
			      <m:apply>
				<m:times/>
				<m:cn>2</m:cn>
				<m:pi/>
			      </m:apply>
			      <m:ci>N</m:ci>
			    </m:apply>
			    <m:ci>k</m:ci>
			    <m:apply>
			      <m:minus/>
			      <m:ci>n</m:ci>
			      <m:ci>m</m:ci>
			    </m:apply>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	where we can reduce the second summation found in the above
	equation into 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci type="fn" class="discrete">h</m:ci>
	      <m:ci>
		<m:msub>
		  <m:apply>
		    <m:ci>
		      <m:mo>(</m:mo>
		      <m:mo>(</m:mo>
		      <m:mi>n</m:mi>
		      <m:mo>−</m:mo>
		      <m:mi>m</m:mi>
		      <m:mo>)</m:mo>
		      <m:mo>)</m:mo>
		    </m:ci>
		  </m:apply>
		  <m:mi>N</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	    <m:apply>
	      <m:times/>
	      <m:apply>
		<m:divide/>
		<m:cn>1</m:cn>
		<m:ci>N</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:cn>0</m:cn>
		</m:lowlimit>
		<m:uplimit>
		  <m:apply>
		    <m:minus/>
		    <m:ci>N</m:ci>
		    <m:cn>1</m:cn>
		  </m:apply>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">H</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:power/>
		    <m:exponentiale/>
		    <m:apply>
		      <m:times/>
		      <m:ci>j</m:ci>
		      <m:apply>
			<m:divide/>
			<m:apply>
			  <m:times/>
			  <m:cn>2</m:cn>
			  <m:pi/>
			</m:apply>
			<m:ci>N</m:ci>
		      </m:apply>
		      <m:ci>k</m:ci>
		      <m:apply>
			<m:minus/>
			<m:ci>n</m:ci>
			<m:ci>m</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:apply>
	</m:math>

	<m:math display="block">
	  <m:apply>
	    <m:eq/>
	    <m:apply>
	      <m:ci type="fn" class="discrete">y</m:ci>
	      <m:ci>n</m:ci>
	    </m:apply>
	    <m:apply>
	      <m:sum/>
	      <m:bvar>
		<m:ci>m</m:ci>
	      </m:bvar>
	      <m:lowlimit>
		<m:cn>0</m:cn>
	      </m:lowlimit>
	      <m:uplimit>
		<m:apply>
		  <m:minus/>
		  <m:ci>N</m:ci>
		  <m:cn>1</m:cn>
		</m:apply>
	      </m:uplimit>
	      <m:apply>
		<m:times/>
		<m:apply>
		  <m:ci type="fn" class="discrete">f</m:ci>
		  <m:ci>m</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>
		    <m:msub>
		      <m:apply>
			<m:ci>
			  <m:mo>(</m:mo>
			  <m:mo>(</m:mo>
			  <m:mi>n</m:mi>
			  <m:mo>−</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>)</m:mo>
			  <m:mo>)</m:mo>
			</m:ci>
		      </m:apply>
		      <m:mi>N</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:apply>
	</m:math> which equals circular convolution!  When we have 
	<m:math>
	  <m:apply>
	    <m:leq/>
	    <m:cn>0</m:cn>
	    <m:ci>n</m:ci>
	    <m:apply>
	      <m:minus/>
	      <m:ci>N</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	  </m:apply>
	</m:math> in the above, then we get:

	<equation id="eq4">
	  <m:math>
	    <m:apply>
	      <m:equivalent/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:mo>⊛</m:mo>
		<m:apply>
		  <m:ci type="fn" class="discrete">f</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	<note type="note">
	  The notation 
	  <m:math>
	    <m:mo>⊛</m:mo>
	  </m:math> represents cyclic convolution "mod N".
	</note>
      </para>

      <section id="sub1">
	<name>Steps for Cyclic Convolution</name>
	<para id="para4">
	  Steps for cyclic convolution are the same as the usual convo,
	  except all index calculations are done "mod N" = "on the wheel"
	</para>

	<list id="step1" type="bulleted">
	  <name>Steps for Cyclic Convolution</name>

	  <item>Step 1:  "Plot"  
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> and 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:apply>
		  <m:ci>
		    <m:msub>
		      <m:apply>
			<m:mo>(</m:mo>
			<m:mo>(</m:mo>
			<m:mo>−</m:mo>
			<m:mn>m</m:mn>
			<m:mo>)</m:mo>
			<m:mo>)</m:mo>
		      </m:apply>
		      <m:mi>N</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
	      </m:apply>
	    </m:math> 
	  </item>
	</list>

	<figure id="fig1">
	  <subfigure id="sub1_f1">
	    <media type="image/png" src="cconv_s1.png"/>
	  </subfigure>
	  <subfigure id="sub2_f1">
	    <media type="image/png" src="cconv_s2.png"/>
	  </subfigure>
	  <caption>
	    Step 1
	  </caption>
	</figure>

	<list id="step2" type="bulleted">
	  <item>Step 2:  "Spin" 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:apply>
		  <m:ci>
		    <m:msub>
		      <m:apply>
			<m:mo>(</m:mo>
			<m:mo>(</m:mo>
			<m:mo>−</m:mo>
			<m:mn>m</m:mn>
			<m:mo>)</m:mo>
			<m:mo>)</m:mo>
		      </m:apply>
		      <m:mi>N</m:mi>
		    </m:msub>
		  </m:ci>
		</m:apply>
	      </m:apply>
	    </m:math> 
	    <m:math>
	      <m:ci>n</m:ci>
	    </m:math> notches ACW (counter-clockwise) to get
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:ci>
		  <m:msub>
		    <m:apply>
		      <m:mo>(</m:mo>
		      <m:mo>(</m:mo>
		      <m:mn>n</m:mn>
		      <m:mo>−</m:mo>
		      <m:mn>m</m:mn>
		      <m:mo>)</m:mo>
		      <m:mo>)</m:mo>
		    </m:apply>
		    <m:mi>N</m:mi>
		  </m:msub>
		</m:ci>
	      </m:apply>
	    </m:math> (i.e. Simply rotate the sequence, 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	    </m:math>, clockwise by <m:math><m:ci>n</m:ci></m:math>
	    steps).
		  
	  </item>
	</list>
	
	<figure id="fig2">
	  <media type="image/png" src="cconv_s3.png"/>
	  <caption>
	    Step 2
	  </caption>
	</figure>

	<list id="step3" type="bulleted">
	  <item>Step 3:  Pointwise multiply the 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> wheel and the 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:ci>
		  <m:msub>
		    <m:apply>
		      <m:mo>(</m:mo>
		      <m:mo>(</m:mo>
		      <m:mn>n</m:mn>
		      <m:mo>−</m:mo>
		      <m:mn>m</m:mn>
		      <m:mo>)</m:mo>
		      <m:mo>)</m:mo>
		    </m:apply>
		    <m:mi>N</m:mi>
		  </m:msub>
		</m:ci>
	      </m:apply>
	    </m:math> wheel.  

	    <m:math display="block">
	      <m:apply>
		<m:eq/>
		<m:ci>sum</m:ci>
		<m:apply>
		  <m:ci type="fn" class="discrete">y</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </item>
	</list>

	<list id="step4" type="bulleted">
	  <item>
	    Step 4:  Repeat for all 
	    <m:math>
	      <m:apply>
		<m:leq/>
		<m:cn>0</m:cn>
		<m:ci>n</m:ci>
		<m:apply>
		  <m:minus/>
		  <m:ci>N</m:ci>
		  <m:cn>1</m:cn>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </item>
	</list>


	<example id="mainExmpl">
	  <name>Convolve (n = 4)</name>
	  
	  <figure id="fig3">
	    <subfigure id="sub1_f3">
	      <media type="image/png" src="cconv_p1.png"/>
	    </subfigure>
	    <subfigure id="sub2_f3">
	      <media type="image/png" src="cconv_p2.png"/>
	    </subfigure>
	    <caption>
	      Two discrete-time signals to be convolved.
	    </caption>
	  </figure>
	  
	  <para id="paraex1">
	    <list id="eg_l1">
	      <item>
		<m:math>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:ci>
		      <m:msub>
			<m:apply>
			  <m:mo>(</m:mo>
			  <m:mo>(</m:mo>
			  <m:mo>−</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>)</m:mo>
			  <m:mo>)</m:mo>
			</m:apply>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:math>
	      </item>
	    </list>
	  </para>

	  <figure id="fig4">
	    <media type="image/png" src="cconv_p3.png"/>
	  </figure>
	  

	  <para id="paraex2">
	    Multiply 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> and 
	    <m:math>
	      <m:ci>sum</m:ci>
	    </m:math> to yield: 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">y</m:ci>
		  <m:cn>0</m:cn>
		</m:apply>
		<m:cn>3</m:cn>
	      </m:apply>
	    </m:math>
	  </para>

	  <para id="paraex3">
	    <list id="eg_l2">
	      <item>
		<m:math>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:ci>
		      <m:msub>
			<m:apply>
			  <m:mo>(</m:mo>
			  <m:mo>(</m:mo>
			  <m:mn>1</m:mn>
			  <m:mo>−</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>)</m:mo>
			  <m:mo>)</m:mo>
			</m:apply>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:math>
	      </item>
	    </list>
	  </para>

	  <figure id="fig5">
	    <media type="image/png" src="cconv_p4.png"/>
	  </figure>
	  
	  <para id="paraex4">
	    Multiply 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> and 
	    <m:math>
	      <m:ci>sum</m:ci>
	    </m:math> to yield: 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">y</m:ci>
		  <m:cn>1</m:cn>
		</m:apply>
		<m:cn>5</m:cn>
	      </m:apply>
	    </m:math>
	  </para>

	  <para id="paraex5">
	    <list id="eg_l3">
	      <item>
		<m:math>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:ci>
		      <m:msub>
			<m:apply>
			  <m:mo>(</m:mo>
			  <m:mo>(</m:mo>
			  <m:mn>2</m:mn>
			  <m:mo>−</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>)</m:mo>
			  <m:mo>)</m:mo>
			</m:apply>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:math>
	      </item>
	    </list>
	  </para>
	  
	  <figure id="fig6">
	    <media type="image/png" src="cconv_p5.png"/>
	  </figure>
	  
	  <para id="paraex6">
	    Multiply 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> and 
	    <m:math>
	      <m:ci>sum</m:ci>
	    </m:math> to yield: 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">y</m:ci>
		  <m:cn>2</m:cn>
		</m:apply>
		<m:cn>3</m:cn>
	      </m:apply>
	    </m:math>
	  </para>

	  <para id="paraex7">
	    <list id="eg_l4">
	      <item>
		<m:math>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:ci>
		      <m:msub>
			<m:apply>
			  <m:mo>(</m:mo>
			  <m:mo>(</m:mo>
			  <m:mn>3</m:mn>
			  <m:mo>−</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>)</m:mo>
			  <m:mo>)</m:mo>
			</m:apply>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:math>
	      </item>
	    </list>
	  </para>

  	  <figure id="fig7">
	    <media type="image/png" src="cconv_p6.png"/>
	  </figure>

	  <para id="paraex8">
	    Multiply 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>m</m:ci>
	      </m:apply>
	    </m:math> and 
	    <m:math>
	      <m:ci>sum</m:ci>
	    </m:math> to yield: 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">y</m:ci>
		  <m:cn>3</m:cn>
		</m:apply>
		<m:cn>1</m:cn>
	      </m:apply>
	    </m:math>
	  </para>
	</example>

	<example id="vi_demo">
	<para id="para_vi_demo_1">
	    The following demonstration allows you to explore this
	    algorithm for circular convolution. See <cnxn document="m11550">here</cnxn> for instructions on how to
	    use the demo.
	  </para><para id="element-845"><media type="application/x-labviewrpvi80" src="DTCircularConvolution.llb">
		<param name="lvfppviname" value="DT Circular Convolution.vi"/>
		<param name="width" value="580"/>
		<param name="height" value="600"/>
	</media></para></example>
      </section>


      <section id="sub2">
	<name>Alternative Algorithm</name>
	<list id="altmeth" type="bulleted">
	  <name>Alternative Circular Convolution Algorithm</name>
	  <item>
	    Step 1:  Calculate the DFT of 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">f</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	    </m:math> which yields 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">F</m:ci>
		<m:ci>k</m:ci>
	      </m:apply>
	    </m:math> 
	    and calculate the DFT of 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">h</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	    </m:math> which yields 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">H</m:ci>
		<m:ci>k</m:ci>
	      </m:apply>
	    </m:math>.
	  </item>

	  <item>
	    Step 2:  Pointwise multiply 
	    <m:math>
	      <m:apply>
		<m:eq/>
		<m:apply>
		  <m:ci type="fn" class="discrete">Y</m:ci>
		  <m:ci>k</m:ci>
		</m:apply>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">F</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">H</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:math>
	  </item>

	  <item>
	    Step 3:  Inverse DFT 
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">Y</m:ci>
		<m:ci>k</m:ci>
	      </m:apply>
	    </m:math> which yields
	    <m:math>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	    </m:math>
	  </item>
	</list>


	<para id="palt1">
	  Seems like a roundabout way of doing things,
	  <emphasis>but</emphasis> it turns out that there are
	  <emphasis>extremely</emphasis> fast ways to calculate the
	  DFT of a sequence.
	</para>
	<para id="palt2">
	  To circularily convolve 
	  <m:math>
	    <m:cn>2</m:cn>
	  </m:math> 
	  <m:math>
	    <m:ci>N</m:ci>
	  </m:math>-point sequences:
	  <m:math display="block">
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>m</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:cn>0</m:cn>
		</m:lowlimit>
		<m:uplimit>
		  <m:apply>
		    <m:minus/>
		    <m:ci>N</m:ci>
		    <m:cn>1</m:cn>
		  </m:apply>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">f</m:ci>
		    <m:ci>m</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:ci>
		      <m:msub>
			<m:apply>
			  <m:ci>
			    <m:mo>(</m:mo>
			    <m:mo>(</m:mo>
			    <m:mi>n</m:mi>
			    <m:mo>−</m:mo>
			    <m:mi>m</m:mi>
			    <m:mo>)</m:mo>
			    <m:mo>)</m:mo>
			  </m:ci>
			</m:apply>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	  For each 
	  <m:math>
	    <m:ci>n</m:ci>
	  </m:math> : 
	  <m:math>
	    <m:ci>N</m:ci>
	  </m:math> 
	  multiples, 
	  <m:math>
	    <m:apply>
	      <m:minus/>
	      <m:ci>N</m:ci>
	      <m:cn>1</m:cn>
	    </m:apply>
	  </m:math> 
	  additions
	</para>
	<para id="palt3">
	  <m:math>
	    <m:ci>N</m:ci>
	  </m:math> 
	  points implies 
	  <m:math>
	    <m:apply>
	      <m:power/>
	      <m:ci>N</m:ci>
	      <m:cn>2</m:cn>
	    </m:apply>
	  </m:math> 
	  multiplications, 
	  <m:math> 
	    <m:apply>
	      <m:times/>
	      <m:ci>N</m:ci>
	      <m:apply>
		<m:minus/>
		<m:ci>N</m:ci>
		<m:cn>1</m:cn>
	      </m:apply>
	    </m:apply>
	  </m:math> 
	  additions implies 
	  <m:math>
	    <m:apply>
	      <m:ci type="fn">O</m:ci>
	      <m:apply>
		<m:power/>
		<m:ci>N</m:ci>
		<m:cn>2</m:cn>
	      </m:apply>
	    </m:apply>
	  </m:math> complexity.
	</para>




      </section>
    </section>

  </content>
</document>
