我正在嘗試將數據集擬合到這個方程的怪物。我知道以前有人問過這個問題,但我不認為最初的猜測是我的問題,我也不能在我的擬合方程中添加更多項。我的擬合方程。請注意積分中的“u”與上面定義的 u 不同。順便說一下,我的數據集以 mA/um 為單位。我在函數F 中實現了這一點,它接受輸入 Vd、T、r 和 Vt。T、r 和 Vt 是擬合參數。T 和 r 的范圍從 0我的前幾個程序有可怕的擬合(如果它甚至可以完成積分),所以我決定看看算法是否有效。該函數的實現如下:from scipy import integratefrom scipy.optimize import curve_fitimport numpy as npimport matplotlib.pyplot as plt#ConstantseSiO2 = 3.9 #Relative dielectric constant of SiO2tox = 2e-9 #Gate oxide thickness in mevac = 8.854e-12 #Vacuum permittivity, F/mem = 0.2*9.11e-31 #Effective electron mass in kgKT = 4.11e-21 #Thermal energy in joulesMv = 2.5 #Degeneracy factorq = 1.6e-19 #Electron charge, coulombshbar = 1.054e-34 #Reduced plancks constantVg = 1def F(Vd,T,r,Vt): #Derived constants required for computation Ci = (eSiO2*evac)/tox #Oxide capacitance per area ved = (q*r*Vd)/(KT) #little Vd I0 = (np.sqrt(2)*q*(KT**1.5)*Mv*np.sqrt(em))/(np.pi*hbar)**2 #Leakage Current #Rho rho1 = 2*np.pi*hbar**2*Ci rho2 = q*KT*em*Mv rhoV = Vg-Vt rho = (rho1*rhoV)/rho2 #u UA = 1 + np.exp(ved) UB = np.exp(ved)*(np.exp(rho)-1) Usq = np.sqrt(UA**2+4*UB) u = np.log(Usq-UA)-np.log(2) #Integrand of F(u) def integrand1(A,x): return (np.sqrt(A))/(1+np.exp(A-x)) #Integrand of F(u-v) def integrand2(A,x): return (np.sqrt(A))/(1+np.exp(A-x)) sum1 = 0 sum2 = 0 tempy1=[] tempy2=[] tempx2=[] #Tempx2 = dummy variable domain tempx2 = np.linspace(0,100,num=10000) #Fitting parameters are determined if Ready is True: #Evaluate the integrands for all the Vd values tempy1 = integrand1(tempx2,u) tempy2 = integrand2(tempx2,u-ved)
1 回答

喵喔喔
TA貢獻1735條經驗 獲得超5個贊
您丟棄所有結果tempy1和tempy2除了最后一個。我認為您想附加到列表中。
改變
for i in range (0,len(u)):
tempy1 = integrand1(tempx2,u[i])
tempy2 = integrand2(tempx2,u[i]-ved[i])
到
for i in range (0,len(u)):
tempy1.append(integrand1(tempx2,u[i]))
tempy2.append(integrand2(tempx2,u[i]-ved[i]))
導致兩個圖重疊。
添加回答
舉報
0/150
提交
取消