使用的函数:
numpy.polyfit
进行拟合:
#求x,y的多项式
z1 = np.polyfit(x,list(y),6)
p1 = np.poly1d(z1)# 转换成多项式表达式
然后这里的p1就是我们要画的曲线图
在scipy下有这个图
https://scipy-lectures.org/intro/scipy/auto_examples/plot_curve_fit.html
python学习——在图里添加多项式拟合曲线
最新推荐文章于 2022-06-14 13:02:51 发布