title: Creating Non Linear Regression with Python
body: <p>I have a simple data;</p>
  
  <pre><code>x = numpy.array([1,2,3,
                   4,5,6,
                   7,8,9,
                   10,11,12,
                   13,14,15,
                   16,17,18,
                   19,20,21,
                   22,23,24])
  
  
  y = numpy.array([2149,2731,3397,
                   3088,2928,2108,
                   1200,659,289,
                   1141,1726,2910,
                   4410,5213,5851,
                   5817,5307,4314,
                   3656,3081,3103,
                   3535,4512,5584])
  </code></pre>
  
  <p>I can create linear regression and make guess with this code:</p>
  
  <pre><code>z = numpy.polyfit(x, y, 1)
  p = numpy.poly1d(z)
  </code></pre>
  
  <p>But I want to create non linear regression of this data and draw graph with code like this:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  xp1 = numpy.linspace(1,24,100)
  plt.plot(x, y, 'r--', xp1, p(xp1))
  plt.show()
  </code></pre>
  
  <p>I saw a code like this but that couldn't help me:</p>
  
  <pre><code>def func(x, a, b, c):
      return a*np.exp(-b*x) + c
  ...
  popt, pcov = curve_fit(func, x, y)
  ...
  </code></pre>
  
  <p>So what's the code for making non linear regression and what can i make some guesses with non linear equation?</p>