标签:taf 参数 panda only 应该 一个 python show def
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
data = pd.read_csv("W-900K.csv")
data.head()
ind | val | |
---|---|---|
0 | 0.0 | 899.56250 |
1 | 0.1 | 932.16851 |
2 | 0.2 | 977.79814 |
3 | 0.3 | 1029.72737 |
4 | 0.4 | 1131.46345 |
plot1=plt.plot(data['ind'], data['val'], '*',label='original values')
plt.xlabel('x')
plt.ylabel('y')
plt.legend(loc=4)
plt.title('ORIGIN VALUES')
plt.show()
def func(x,a,b,c):
return a*np.exp(b*x) + c
popt, pcov = curve_fit(func, data['ind'], data['val'])
print(popt)
[-443.68006622 -2.49480416 1293.98737632]
# 原始数据
plt.plot(data['ind'], data['val'], '*',label='original values')
# 拟合出的数据
plt.plot(data['ind'], func(data['ind'],popt[0],popt[1],popt[2]), 'r',label='curve fit values')
plt.xlabel('x')
plt.ylabel('y')
plt.legend(loc=4)
plt.title('COMPARISON')
plt.show()
标签:taf 参数 panda only 应该 一个 python show def
原文地址:https://www.cnblogs.com/aloe-n/p/11438550.html