Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from numpy import *
- from scipy.optimize import curve_fit
- def func(x, a, b, c):
- return a*exp(-(x-b)**2/(2*c**2))
- file = loadtxt("angdist1.xvg", skiprows = 18, dtype = float)
- x = []
- y = []
- for i in range(shape(file)[0]):
- x.append(file[i,0])
- y.append(file[i,1])
- popt, pcov = curve_fit(func, x, y)
- plt.plot(x, func(x, *popt), color = 'red', linewidth=2)
- plt.legend(['Original','fitting'], loc=0)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement