title: Matlab freqz function in Python
body: <p>I am trying to implement a Python equivalent for the Matlab frequency response function</p>
  
  <pre><code>[h,f] = freqz(b, 1, 512, 12.5)
  </code></pre>
  
  <p>described in <a href="http://se.mathworks.com/help/signal/ug/frequency-response.html" rel="nofollow">here</a>. My current attempt</p>
  
  <pre><code>f, h = scipy.signal.freqz(b, 1)
  </code></pre>
  
  <p>does not give the intended result. Trying the parameters <code>worN</code> and <code>whole</code> (see <a href="http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.signal.freqz.html" rel="nofollow">here</a>) do not seem to fix the issue.</p>
  
  <p>How should it be done?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>Matlab example:</p>
  
  <pre><code>&gt;&gt; [h, f] = freqz(1:5, 1, 512, 12.5)
  
  h =
  
    15.0000 + 0.0000i
    14.9976 - 0.2454i
    14.9902 - 0.4907i
    14.9780 - 0.7358i
    14.9609 - 0.9806i
    14.9389 - 1.2250i
    ...
  
  f =
  
           0
      0.0122
      0.0244
      0.0366
      0.0488
      0.0610
      ...
  </code></pre>
  
  <p>Python example:</p>
  
  <pre><code>&gt;&gt;&gt; f, h = scipy.signal.freqz(range(1,6), 1)
  &gt;&gt;&gt; h
  array([ 15.00000000 +0.j        ,  14.99755288 -0.24541945j,
          14.99021268 -0.49073403j,  14.97798292 -0.73583892j,
          14.96086947 -0.98062944j,  14.93888050 -1.22500102j,
          ...])
  &gt;&gt;&gt; f
  array([ 0.        ,  0.00613592,  0.01227185,  0.01840777,  0.02454369,
          0.03067962,  ...])
  </code></pre>
  
  <p>In other words, the Scipy function gives good values for <code>h</code>, but the values of <code>f</code> do not match.</p>