title: Fitting a curve to only a few data points
body: <p>I have a scatter plot with only 5 data points, which I would like to fit a curve to. I have tried both polyfit and the following code, but neither are able to produce a curve with so few data points </p>
  
  <pre><code>def func(x, a, b, c):
   return a * np.exp(-b * x) + c
  plt.plot(xdata, ydata, ".", label="Data");
  optimizedParameters, pcov = opt.curve_fit(func, xdata, ydata);
  plt.plot(xdata, func(xdata, *optimizedParameters), label="fit");
  </code></pre>
  
  <p>Attached is an example of the plot, along with an example of the kind of curve I am trying to produce (apologies for the bad drawing). Thanks!</p>
  
  <p><a href="https://i.stack.imgur.com/xKOCd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xKOCd.png" alt="enter image description here"></a></p>