I have come across a problem when playing with the parameters of the curve\_fit from scipy. I have initially copied the code suggested by the docs. I then changed the equation slightly and it was fine, but having increased the np.linspace, the whole prediction ended up being a straight line. Any ideas?

```
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

def f(x, a, b, c):
    # This works fine on smaller numbers
    return (a - c) * np.exp(-x / b) + c

xdata = np.linspace(60, 3060, 200)
ydata = f(xdata, 100, 400, 20)

# noise
np.random.seed(1729)
ydata = ydata + np.random.normal(size=xdata.size) * 0.2

# graph
fig, ax = plt.subplots()
plt.plot(xdata, ydata, marker="o")
pred, covar = curve_fit(f, xdata, ydata)
plt.plot(xdata, f(xdata, *pred), label="prediciton")
plt.show()

```

[![Clear exponential gving a straight line fit](https://i.stack.imgur.com/xlsoj.png)](https://i.stack.imgur.com/xlsoj.png)