I have data where my x column corresponds to the residue position and the y axis corresponds to the entropy value. I want to do a curve-fitting on the data obtained. I was trying to fit a Gaussian curve but the curve is not fitting according to what it should look like. Can anyone suggest to me what should be an optimal way to do so?
from scipy.optimize import curve_fit x = [18,23,95,142,154,156,157,158,258,318,367,382,484,501,522,574,681,832,943,1071,1078,1101,1133,1153,1174,1264] y = [0.179,0.179,0.692,0.574,0.669,0.295,0.295,0.295,0.387,0.179,0.179,0.462,0.179,0.179,0.179,0.179,0.179,0.179,0.179,0.179,0.179,0.462,0.179,0.387,0.179,0.295] x = np.asarray(x) y = np.asarray(y) amp1 = 100 sigma1 = 10 cen1 = 50 def Gauss(x, A, B): y = A*np.exp(-1*B*x**2) return y parameters, covariance = curve_fit(Gauss, x, y) fit_A = parameters fit_B = parameters fit_y = Gauss(x, fit_A, fit_B) plt.figure(figsize=(18,10)) plt.plot(x, y, label="data") plt.plot(x, fit_y, label="fit") plt.legend() plt.show()