我们得到的Ic值是mA范围和数量级.1~2 mA,当磁场从-1500 t0 1500扫描时,它们之间存在高斯分布。
我通过Python文档找到了这个Curve_Fitting代码,但是想知道是否可以在Python中对Bars进行曲线拟合?
def func(x, I, CorrectedBitSize, Lambda, M):
return I * abs(
2 * sp.jv(1, (
(float(CorrectedBitSize) * (
2 * abs(Lambda) + 2 * dN + dF) * (x + M)) /
(phi0 * math.pow(10, 10)))) / (
(float(CorrectedBitSize) * (
2 * Lambda + 2 * dN + dF) * (x + M)) /
(phi0 * math.pow(10, 10))
)
)
dF = 2 * math.pow(10, -9) # thickness
dN = 5 * math.pow(10, -9) # thickness
mu0 = 4 * math.pi * math.pow(10, -7) # constant
phi0 = 6.62607 * math.pow(10, -34) / (2 * 1.6 * math.pow(10, -19))
Ic_Bins_pos = np.array(random);
Ic_Bins_Field_Pos = np.array(-1500, 1500)
Lambda = (0.00000009)
best_vals, covar = curve_fit(func, Ic_Bins_Field_pos, Ic_Bins_pos, sigma=.2)
# popt, pcov = leastsq(func, Ic_Bins_Field_pos, Ic_Bins_pos)
y = func(Ic_Bins_Field_pos, *best_vals)
x = np.linspace(-1500, 1500, len(y))
y_noise = 0.2 * x
yfit = y_noise + y
plt.plot(Ic_Bins_Field_pos, yfit, c='g')
# plt.show()