<?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="m11539">
  <name>Convolution - Discrete time</name>
  <metadata>
  <md:version>1.4</md:version>
  <md:created>2003/08/05 04:55:07 GMT-5</md:created>
  <md:revised>2003/08/08 03:59:25.117 GMT-5</md:revised>
  <md:authorlist>
    <md:author id="Anders">
      <md:firstname>Anders</md:firstname>
      
      <md:surname>Gjendemsjo</md:surname>
      <md:email>gjendems@tele.ntnu.no</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="Anders">
      <md:firstname>Anders</md:firstname>
      
      <md:surname>Gjendemsjo</md:surname>
      <md:email>gjendems@tele.ntnu.no</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>Convolution</md:keyword>
    <md:keyword>Discrete</md:keyword>
    <md:keyword>Analog</md:keyword>
  </md:keywordlist>

  <md:abstract>Time discrete convolution</md:abstract>
</metadata>

  <content>
      <section id="s1">
      <name>Introduction</name>
      <para id="s1p3">
	The idea of <term>discrete-time convolution</term> is exactly
	the same as that of <cnxn document="m10085">continuous-time convolution</cnxn>.  For this
	reason, it may be useful to look at both versions to help your
	understanding of this extremely important concept.
        Convolution is a very powerful tool in determining a
	system's output from knowledge of an arbitrary input and the
	system's impulse response.
      </para>
      <para id="s1p4">
        It also helpful to see convolution graphically, i.e. by using transparencies or Java Applets.
        <link src="http://www.jhu.edu">Johns Hopkins University</link> has an excellent
	<link src="http://www.jhu.edu/signals"> Discrete time convolution</link> applet.
	Using this resource will help understanding this crucial concept.
      </para>
    </section>

     <section id="s2">
      <name>Derivation of the convolution sum</name>
      <para id="s2p1">
	We know that any discrete-time signal can be represented by a
	summation of scaled and shifted discrete-time impulses, see
	<cnxn document="m11476" target="s3s1"/>. Since
	we are assuming the system to be linear and time-invariant, it
	would seem to reason that an input signal comprised of the sum
	of scaled and shifted impulses would give rise to an output
	comprised of a sum of scaled and shifted impulse responses.
	This is exactly what occurs in <term>convolution</term>.
	Below we present a more rigorous and mathematical look at the
	derivation:
      </para>

      <para id="s2p2">
	Letting <m:math><m:ci>ℋ</m:ci></m:math> be a discrete time LTI
	system, we start with the folowing equation and work our way
	down the the convoluation sum.

	<equation id="conv_der">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:ci>ℋ</m:ci>
		<m:apply>
		  <m:ci>x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:ci>ℋ</m:ci>
		<m:apply>
		  <m:sum/>
		  <m:bvar>
		    <m:ci>k</m:ci>
		  </m:bvar>
		  <m:uplimit>
		    <m:infinity/>
		  </m:uplimit>
		  <m:lowlimit>
		    <m:apply>
		      <m:minus/>
		      <m:infinity/>
		    </m:apply>
		  </m:lowlimit>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci>x</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci>δ</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:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		  <m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:ci>ℋ</m:ci>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci>x</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci>δ</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:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		  <m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci>x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci>ℋ</m:ci>
		    <m:apply>
		      <m:ci>δ</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:apply>
		<m:sum/>
		<m:bvar><m:ci>k</m:ci></m:bvar>
		<m:uplimit><m:infinity/></m:uplimit>
		<m:lowlimit><m:apply><m:minus/><m:infinity/></m:apply></m:lowlimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci>x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci>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>

	Let us take a quick look at the steps taken in the above
	derivation.  After our initial equation we rewrite the function
	<m:math>
	  <m:apply>
	    <m:ci>x</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>
	as a sum of the function times the unit impulse.  Next, we can
	move around the ℋ operator and the summation because
	<m:math>
	  <m:apply>
	    <m:ci>ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math> is a linear, DT system. Because of this linearity
	and the fact that
	<m:math>
	  <m:apply>
	    <m:ci>x</m:ci>
	    <m:ci>k</m:ci>
	  </m:apply>
	</m:math> is a constant, we pull the constant out and simply multiply it by
	<m:math>
	  <m:apply>
	    <m:ci>ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math>.  Finally, we use the fact that
	<m:math>
	  <m:apply>
	    <m:ci>ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math> is time invariant in order to reach our final state
	- the convolution sum!
      </para><!--end para s2p2-->

      <para id="s2p3">
          Above the summation is taken over all integers. Howerer, in many practical
	  cases either
	  <m:math>
	      <m:apply>
	          <m:ci>x</m:ci>
		  <m:ci>n</m:ci>
	      </m:apply>
	  </m:math> or
	  <m:math>
	      <m:apply>
	          <m:ci>h</m:ci>
		  <m:ci>n</m:ci>
	      </m:apply>
	  </m:math> or both
	  are finite, for which case the summations will be limited.
	  The convolution equations are simple tools which, in principle, can be used
	  for all input signals. Following is an example to demonstrate convolution;
	  how it is calculated and how it is interpreted.
	  

      </para>
      <section id="s2s1">
          <name>Graphical illustration of convolution properties</name>
      <para id="s2s1p1">
	A quick graphical example may help in demonstrating why
	convolution works.
      </para>

      <figure id="figx">
	<media type="image/png" src="dconv1b.png"/>
	<caption>
	  A single impulse input yields the system's impulse response.
	</caption>
      </figure>

      <figure id="figx2">
	<media type="image/png" src="dconv2b.png"/>
	<caption>
	  A scaled impulse input yields a scaled response, due to
	  the scaling property of the system's linearity.
	</caption>
      </figure>

      <figure id="figx3">
	<media type="image/png" src="dconv3b.png"/>
	<caption>
	  We now use the time-invariance property of the system to
	  show that a delayed input results in an output of the same
	  shape, only delayed by the same amount as the input.
	</caption>
      </figure>

      <figure id="figx4">
	<media type="image/png" src="dconv4b.png"/>
	  <caption>
	  We now use the additivity portion of the linearity
	  property of the system to complete the picture.  Since any
	  discrete-time signal is just a sum of scaled and shifted
	  discrete-time impulses, we can find the output from
	  knowing the input and the impulse response.
	</caption>
      </figure>
      </section>
    </section>




    <section id="s3">
      <name>Convolution Sum</name>
      <para id="s3p1">
	As mentioned above, the convolution sum provides a concise,
	mathematical way to express the output of an LTI system based
	on an arbitrary discrete-time input signal and the system's
	response.  The <term>convolution sum</term> is expressed
	as

	<equation id="eqn2">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>y</m:ci>
		<m:ci>n</m:ci>
	      </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>x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci>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>

	As with continuous-time, convolution is represented by the
	symbol *, and can be written as

	<equation id="eqn3">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>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>x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci>h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	By making a simple change of variables into the convolution
	sum,
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>k</m:ci>
	    <m:apply>
	      <m:minus/>
	      <m:ci>n</m:ci>
	      <m:ci>k</m:ci>
	    </m:apply>
	  </m:apply>
	</m:math>,
	we can easily show that convolution is
	<term>commutative</term>:

	<equation id="eqn4">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
	          <m:ci>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>x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci>h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#convolve"/>
		<m:apply>
		  <m:ci>h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci>x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	From <cnxn target="eqn4"/> we get a convolution sum that is equivivalent to the
	sum in <cnxn target="eqn2"/>:
	<equation id="eqn5">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>y</m:ci>
		<m:ci>n</m:ci>
	      </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>h</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci>x</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>



	For more information on the characteristics of convolution,
	read about the <cnxn document="m10088">Properties
	of Convolution</cnxn>.
      </para>
    </section>

    <section id="s4">
      <name>Convolution Through Time (A Graphical Approach)</name>
      <para id="s4p1">
	In this section we will develop a second graphical
	interpretation of discrete-time convolution.  We will begin
	this by writing the convolution sum allowing
	<m:math display="inline">
	  <m:ci>x</m:ci>
	</m:math>
	to be a causal, length-m signal and
	<m:math display="inline">
	  <m:ci>h</m:ci>
	</m:math>
	to be a causal, length-k, LTI system.  This gives us the finite
	summation,

	<equation id="eq_eg2">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci>y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>l</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:cn>0</m:cn>
		</m:lowlimit>
		<m:uplimit>
		  <m:apply><m:minus/><m:ci>m</m:ci><m:cn>1</m:cn></m:apply>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci>x</m:ci>
		    <m:ci>l</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci>h</m:ci>
		    <m:apply>
		      <m:minus/>
		      <m:ci>n</m:ci>
		      <m:ci>l</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	Notice that for any given
	<m:math display="inline">
	  <m:ci>n</m:ci>
	</m:math>
	we have a sum of the <m:math><m:ci>m</m:ci></m:math> products of
	<m:math>
	  <m:apply>
	    <m:ci>x</m:ci>
	    <m:ci>l</m:ci>
	  </m:apply>
	</m:math>
	and a time-delayed
	<m:math>
	    <m:apply>
	        <m:ci>h</m:ci>
	        <m:apply> 
	            <m:minus/>  
		    <m:ci>n</m:ci>
		    <m:ci>l</m:ci>
	        </m:apply>
	    </m:apply>
	</m:math>.  
	This is to say that we multiply the terms of
	<m:math display="inline">
	  <m:ci>x</m:ci>
	</m:math>
	by the terms of a time-reversed
	<m:math display="inline">
	  <m:ci>h</m:ci>
	</m:math>
	and add them up.
      </para>

      <para id="p8">
	Going back to the previous example:
      </para>

      <figure id="eg2_fig1">
	<media type="image/png" src="dconv5b.png"/>
	<caption>
	  This is the end result that we are looking to
	    find.
	</caption>
      </figure>

      <figure id="eg2_fig2">
	<media type="image/png" src="dconv6b.png"/>
	<caption>
	  Here we reverse the impulse response,
	  <m:math display="inline">
	    <m:ci>h</m:ci>
	  </m:math>
	  , and begin its traverse at time
	  <m:math display="inline">
	    <m:cn>0</m:cn>
	  </m:math>.
	</caption>
      </figure>

      <figure id="eg2_fig3">
	<media type="image/png" src="dconv7b.png"/>
	<caption>
	  We continue the traverse. See that at time
	  <m:math display="inline">
	      <m:cn>1</m:cn>
	  </m:math>, 
	  we are multiplying two elements of the input signal by
	  two elements of the impulse respone.
	</caption>
      </figure>

      <figure id="eg2_fig4a">
	<media type="image/png" src="dconv8b_2.png"/>
      </figure>

      <figure id="eg2_fig4b">
	<media type="image/png" src="dconv8b_3.png"/>
	<caption>
	  If we follow this through to one more step,
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:ci>n</m:ci>
	      <m:ci>4</m:ci>
	    </m:apply>
	  </m:math>, then we can see that we produce the same output
	  as we saw in the intial example.
	</caption>
      </figure>

      <!--
      <figure id='eg2_fig4c'>
	<media type="image/png" src="dconv8b_3.png"/>
	<caption>
	  See how this method follows through to produce the same
	  output we saw in the initial example.
	</caption>
      </figure>
      -->

      <para id="p8a">
	What we are doing in the above demonstration is reversing the
	impulse response in time and "walking it across" the input
	signal.  Clearly, this yields the same result as scaling,
	shifting and summing impulse responses.
      </para>

      <para id="p9">
	This approach of time-reversing, and sliding across is a
	common approach to presenting convolution, since it
	demonstrates how convolution builds up an output through time.
      </para>
    </section>
   <!-- <section id='s5'>
        <para id='s5p1'>
	    Go to? 
	    <list id='l1' type='inline'>
	        <item><cnxn document='m11542'>Introduction</cnxn></item>
	        <item><cnxn document='m11540'>Convolution - Analog signals</cnxn></item>
	        <item><cnxn document='m10088'>Properties of convolution</cnxn></item>
	    </list>
	</para>
	
    </section> -->
  </content>
  
</document>
