I am having data in.csv file and it contains 2 column x and y axis. The axis are read from .csv file and then fitting the data with stretched exponential function but its showing error.
Here I am giving example data to easy understanding.
My function is f(x) = a. exp (-b.t) ^ c + d
. (Stretched exponential fitting). I want to fit this data according to this function and I want the final value of a, b, c and d.
My coding is:
# Reading data
x=data[1,2,3,4,5,6,7,8,9,10]
y=data[7.2489, 7.0123, 7.0006, 7.0003, 7, 7, 7, 7, 7, 7]
# Fitting Streched Exponential Decay Curve
smoothx = np.linspace(x[0], x[-1], (5*x[-1]))
guess_a, guess_b, guess_c, guess_d = 4000, -0.005, 4, 4000
guess = [guess_a, guess_b, guess_c, guess_d]
f_theory1 = lambda t, a, b, c, d: a * np.exp((b*t)^(c)) + d
p, cov = curve_fit(f_theory1, x, y, p0=np.array(guess))
f_fit1 = lambda t: p[0] * np.exp((p[1] * t)^((p[2]))) + p[3]
plt.show()
Here I am showing only guess and fitting part of my program.
Kindly correct mistakes in my code for better fitting.