<?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="m10917">
    <name>FIR Filter Design using MATLAB</name>
    <metadata>
  <md:version>2.1</md:version>
  <md:created>2002/10/14</md:created>
  <md:revised>2002/10/14</md:revised>
  <md:authorlist>
      <md:author id="choi">
      <md:firstname>Hyeokho</md:firstname>
      
      <md:surname>Choi</md:surname>
      <md:email>choi@ece.rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="choi">
      <md:firstname>Hyeokho</md:firstname>
      
      <md:surname>Choi</md:surname>
      <md:email>choi@ece.rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>FIR</md:keyword>
    <md:keyword>MATLAB</md:keyword>
  </md:keywordlist>

  <md:abstract>This module explains the MATLAB commands for FIR filter design.
</md:abstract>
</metadata>



    <content>
      <section id="sec1">
	<name>FIR Filter Design Using MATLAB</name>
	<!-- one of (rule exercise example table figure codeblock list equation para definition section) -->
	<section id="subsec1">
	  <name>Design by windowing</name>
	  <para id="p1">
	    The MATLAB function <code>fir1()</code> designs
	    conventional lowpass, highpass, bandpass, and bandstop
	    linear-phase FIR filters based on the windowing
	    method. The command
	  </para>
	  <code type="block">
	    <![CDATA[
	    b = fir1(N,Wn)     
	    ]]>
	  </code>
	  <para id="p2">
	    returns in vector <code>b</code> the impulse response of a
	    lowpass filter of order <code>N</code>. The cut-off
	    frequency <code>Wn</code> must be between 0 and 1 with 1
	    corresponding to the half sampling rate.
	  </para>
	  <para id="p3">
	    The command
	  </para>
	  <code type="block">
	    <![CDATA[
	    b = fir1(N,Wn,'high')
	    ]]>
	  </code>
	  <para id="p4">
	    returns the impulse response of a highpass filter of order
	    <code>N</code> with normalized cutoff frequency
	    <code>Wn</code>.
	  </para>
	  <para id="p5">
	    Similarly, <code>b = fir1(N,Wn,'stop')</code> with
	    <code>Wn</code> a two-element vector designating the
	    stopband designs a bandstop filter.
	  </para>
	  <para id="p6">
	    Without explicit specification, the <emphasis>Hamming
	    window</emphasis> is employed in the design.  Other
	    windowing functions can be used by specifying the
	    windowing function as an extra argument of the function.
	    For example, Blackman window can be used instead by the
	    command <code>b = fir1(N, Wn, blackman(N))</code>.
	  </para>
	</section>
	<section id="subsec2">
	  <name>Parks-McClellan FIR filter design</name>
	  <para id="p7">
	    The MATLAB command
	  </para>
	  <code type="block">
	    <![CDATA[
	    b = remez(N,F,A)
	    ]]>
	  </code>
	  <para id="p8">
	    returns the impulse response of the length <code>N+1</code>
	    linear phase FIR filter of order <code>N</code> designed
	    by Parks-McClellan algorithm.  F is a vector of frequency
	    band edges in ascending order between 0 and 1 with 1
	    corresponding to the half sampling rate. A is a real
	    vector of the same size as F which specifies the desired
	    amplitude of the frequency response of the points
	    <code>(F(k),A(k))</code> and <code>(F(k+1),A(k+1))</code>
	    for odd <code>k</code>. For odd <code>k</code>, the bands
	    between <code>F(k+1)</code> and <code>F(k+2)</code> is
	    considered as transition bands.
	  </para>
	</section>
      </section>
      <para id="delete_me">
	<!-- Insert module text here -->
      </para>   
    </content>
    
  </document>
