我有一个二维图,它看起来像是二次曲线。我是从一个数据集得到的,这个数据是通过计算得到的。我知道这个方程可以通过拟合数据集得到。Python似乎是从数据点自动拟合出来的。我需要打印拟合曲线的方程式。在
我解出不同X的Y,得到了两个arrey和X,然后画出它们
plt.plot(X,Y)
plt.xlabel('X')
plt.ylabel('Y')
plt.savefig('YvsX.png', format='png', dpi=1000)
plt.show()
得到了这个:
需要打印这张图的方程式
Tags:
我给你举一个如何找到二次拟合的例子:
输出:
^{pr2}$这意味着x**2+4.2765887e-15*x+2
我从图中提取数据点并执行了一个方程搜索,结果显示“y=a*exp(b/x)+Offset”可能是一个候选方程。这是一个使用提取的数据和该方程的图形拟合器,以及scipy的微分进化遗传算法模块提供的scipy曲线拟合()解算器的初始参数估计。该模块使用拉丁超立方体算法来确保对参数空间的彻底搜索,并要求在该范围内进行搜索。在这个例子中,我使用了最大和最小数据值的边界,这些搜索边界在本例中工作得很好。在
相关问题 更多 >
编程相关推荐