I have data I am trying to fit a exponential to, this data is not ideal however when use JMP's in-build curve fit function it works as expected and a I get a good approximation of my data (please see bellow figure, JMP Fit Curve Exponential 3P).
I am know trying to replicate this using the python library scipy.optimize with the curve_fit function as described here. However this is producing very different curves please see bellow.
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import numpy as np
df = pd.read_csv('test.csv', sep = ',' ,index_col = None, engine='python')
def exponential_3p(x, a, b, c):
return a + b * np.exp(c * x)
popt, pcov = curve_fit(exponential_3p,df.x,df.y)
a = popt[0]
b = popt[1]
c = popt[2]
plt.plot(df.x,df.y)
plt.plot(df.x,exponential_3p(df.x, a, b, c))