我正在尝试拟合数据集。当我绘制最终参数时,看起来像lilke在照片中。我不想要组合x轴的起点和终点的线。我怎样才能做到这一点? 适合看起来像:http://i.stack.imgur.com/heI8d.jpg
def solvePlot(self):
def massFunc(t, a, b, c):
return a*(t*t)+b*t+c
#ravel function turns the list to 1dimension for use to fitting.
self.x = self.Tepoch.ravel()
self.y = self.TOC.ravel()
p0 = [2, 0.2, 28, 6.6]
fitParams, fitCovariances = curve_fit(massFunc, self.x, self.y, p0)
print fitParams
print fitCovariances
sigma = [fitCovariances[0,0], fitCovariances[1,1], fitCovariances[2,2] ]
plt.plot(self.x, massFunc(self.x, fitParams[0], fitParams[1], fitParams[2]))
plt.plot(self.x,self.TOC,'o')
plt.ylabel('O-C')
plt.xlabel('EPOCH')
plt.show()