title: C implementation of filter with Matlab generated coefficients
body: <p>First off, this is intended as some research for a future application.</p>
  
  <p>I want to be able to extract the coefficients from a c header file that is generated by the Matlab Filter Design and Analysis Tool (FDATool).</p>
  
  <p><a href="http://dl.dropbox.com/u/39710897/fdatool.png" rel="nofollow noreferrer">fdatool settings http://dl.dropbox.com/u/39710897/fdatool.png</a></p>
  
  <p>I have used the above settings for the FDATool and then I generated the following C header file:
  <a href="http://dl.dropbox.com/u/39710897/fdacoefs.h" rel="nofollow noreferrer">http://dl.dropbox.com/u/39710897/fdacoefs.h</a></p>
  
  <p>As I understand it I can implement a filter from this by using a direct form difference equation. 
  I believe the equation to be y(n) = b<sub>0</sub>x(n) + b<sub>1</sub>x(n–1) + b<sub>2</sub>x(n–2) – a<sub>1</sub>y(n–1) – a<sub>2</sub>y(n–2) </p>
  
  <p>where the b<sub>0</sub>-b<sub>2</sub> coefficients are the zeroes and the a<sub>1</sub> and a<sub>2</sub> coefficients are the poles.</p>
  
  <p>The problem here is that I'm not entirely sure what is in the header file. This information seems surprisingly hard to find which probably means I'm missing something really obvious...</p>
  
  <p>Here is the information I think I've been able to extract:</p>
  
  <ul>
  <li>Filter is made up from 3 biquadratic (known as "biquad") sections.</li>
  <li>The coefficients for section 1 are: 
  
  <ul>
  <li>b0:0.129355475306511</li>
  <li>b1:-1.997004866600037</li>
  <li>b2:1.000000000000000</li>
  <li>a1:-1.995552659034729</li>
  <li>a2:0.996141731739044</li>
  </ul></li>
  <li>The coefficients for section 2 are: 
  
  <ul>
  <li>b0:0.129355475306511</li>
  <li>b1:-1.999969959259033</li>
  <li>b2:1.000000000000000</li>
  <li>a1:-1.997882604598999</li>
  <li>a2:0.998035132884979</li>
  </ul></li>
  <li>The coefficients for section 3 are: 
  
  <ul>
  <li>b0:0.011426069773734</li>
  <li>b1:0.000000000000000</li>
  <li>b2:-1.000000000000000</li>
  <li>a1:-1.993502736091614</li>
  <li>a2:0.993802070617676</li>
  </ul></li>
  </ul>
  
  <p>Questions:</p>
  
  <ol>
  <li>Is my difference equation suitable for use with the coefficients in the header file?</li>
  <li>Is the information I extracted from the header file correct?</li>
  </ol>