发布时间:2019-08-17 08:48:18编辑:auto阅读(2707)
【polyfit】多项式曲线拟合
【polyval】多项式曲线求值
import numpy as np
import matplotlib.pyplot as plt
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data * 0.1 + 0.3
poly = np.polyfit(x_data, y_data, deg = 1)
plt.plot(x_data, y_data, 'o')
plt.plot(x_data, np.polyval(poly, x_data))
plt.show()
效果:
上一篇: Python自动生成sql语句
下一篇: 让Python脚本暂停执行的几种方法
50994
50377
40992
37859
32325
29216
28100
22928
22897
21224
1089°
1780°
1451°
1389°
1664°
1472°
2130°
3687°
3625°
2546°