我正在尝试使用具有3个参数(p
,alpha
,T
)的函数来拟合2个参数(p
和alpha
)。该函数取决于一系列其他函数(导数,积分,对数等)。我收到此错误:is not a list of real numbers with dimensions {111} at {a,b} = {1.,1.}
。
代码如下:
deltaData = {{1.00, 0}, {0.96, 0.3416}, {0.92, 0.4749}, {0.88, 0.5715}, {0.84, 0.648}, {0.80, 0.711}, {0.76, 0.764}, {0.72, 0.8089}, {0.66, 0.864}, {0.62, 0.8939}, {0.58, 0.919}, {0.54, 0.9399}, {0.50, 0.9569}, {0.46, 0.9704}, {0.42, 0.9809}, {0.38, 0.9885}, {0.34, 0.9938}, {0.30, 0.9971}, {0.26, 0.9989}, {0.22, 0.9997}, {0.16, 1}, {0.14, 1}};
deltaFit = NonlinearModelFit[deltaData, (1 + a*T + c*T^2 + e*T^3 + g*T^4 + i*T^5 + k*T^6)/(1 + b*T + d*T^2 + f*T^3 + h*T^4 + j*T^5 + l*T^6), {a, b, c, d, e, f, g, h, i, j, k, l}, T];
data = {{0.203, 0.031}, {0.203, 0.030}, {0.246, 0.055}, {0.267, 0.072}, {0.300, 0.105}, {0.300, 0.105}, {0.330, 0.147}, {0.373, 0.214}, {0.397, 0.255}, {0.415, 0.293}, {0.445, 0.351}, {0.477, 0.430}, {0.493, 0.463}, {0.520, 0.538}, {0.541, 0.590}, {0.582, 0.717}, {0.589, 0.733}, {0.625, 0.847}, {0.645, 0.911}, {0.685, 1.029}, {0.688, 1.043}, {0.730, 1.181}, {0.751, 1.247}, {0.782, 1.338}, {0.793, 1.375}, {0.830, 1.472}, {0.856, 1.531}, {0.878, 1.585}};
AlphaBCS = 1.746;
(* Functions to obtain fit function *)
delta[T_, p_, alpha_] := p*deltaFit[T] + (1 - p)*deltaFit[T]/alpha;
fx[T_, x_, p_, alpha_] := (Exp[AlphaBCS/T*(x^2 + delta[T, p, alpha]^2)^(1/2)] + 1)^(-1);
Ses[T_, p_, alpha_] := -6*AlphaBCS/Pi^2*NIntegrate[fx[T, x, p, alpha]*Log[fx[T, x, p, alpha]] + (1 - fx[T, x, p, alpha])*Log[1 - fx[T, x, p, alpha]], {x, 0, 100}];
dSes[T_, p_, alpha_] = D[Ses[T, p, alpha], T];
Ces[T_, p_, alpha_] := T*dSes[T, p, alpha];
(* Test Plot *)
Show[ListPlot[data], Plot[Ces[T, 0.5, 1.746], {T, 0.015, .95}], Frame -> True]
(* Fit *)
nlm = NonlinearModelFit[data, Ces[T, p, alpha], {{p, 0.5}, {alpha, 0.5}}, T];
Normal[nlm]
nlm["ParameterTable"]
Show[ListPlot[data], Plot[nlm[T], {T, 0.015, .95}], Frame -> True]
有人知道我如何使工作正常(为p
和alpha
获取正确的值)吗?