我是Python的新用户,我正在尝试将一些实验数据与CDF相匹配。这些数据如下所示,它们应该以x轴对数比例绘制:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
x=np.array([0.995, 3.003, 5.908, 10.525, 13.617, 24.321, 33.917, 47.843, 64.172, 91.353, 126.745, 174.118, 225.059, 292.998, 369.133, 640.295, 828.169, 1255.39, 1496.613, 1942.785])
y=np.array([0.142, 0.2, 0.25, 0.36, 0.498, 0.616, 0.599, 0.7, 0.835, 1.102, 1.083, 1.225, 1.133, 1.165, 1.298, 1.365, 1.298, 1.373, 1.409, 1.538])
pyplot.xscale('log')
plt.plot(x,y,'r.')
我发现了一个来自同一用户的证词,该证词使用以下方法拟合了数据:
^{pr2}$但是,当我试图将这段代码适应我自己的问题(上面显示了数据),这个问题处理的是对数正态分布pdf和cdf,结果并不理想。在
如果有人能帮我,我会非常感激的!在
提前谢谢
您可以通过使用scipy.optimize.curve_fit并定义log函数来拟合y=a*log10(b*x+h)+k(这似乎比对数正态分布更适合您的数据)。在
如果没有原木秤,你会得到像
用原木秤,你的身材看起来像
相关问题 更多 >
编程相关推荐