请问大家,非线性拟合计算报错的原因
mathematica吧
全部回复
仅看楼主
level 3
jdts12 楼主
data = {{43.68, 1.}, {206.42, 0.76}, {398.11, 0.58}, {1019.47,
0.42}, {1910.44, 0.33}, {2964.39, 0.26}, {4116.84,
0.22}, {5318.17, 0.19}, {6505.9, 0.16}, {7709.48, 0.15}, {8827.55,
0.13}, {9984.18, 0.12}, {11015.08, 0.11}};
model = Sum[
4/((2*k + 1)*Pi)*1(*c0*)*
MittagLefflerE[\[Beta], ((-d)*(2*k + 1)^2*\[Pi]^2*t^\[Beta])]*
Sin[(2*k + 1)*Pi*1/2], {k, 0, 10}];
M = NonlinearModelFit[data, model, {{\[Beta], 0.0029}, {d, 0.71}}, t];
General::ovfl: Overflow occurred in computation.
General::ovfl: Overflow occurred in computation.
General::ovfl: Overflow occurred in computation.
General::stop: Further output of General::ovfl will be suppressed during this calculation.
NonlinearModelFit::nrlnum: The function value {Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[],Overflow[]} is not a list of real numbers with dimensions {13} at {\[Beta],d} = {0.0467468,-0.359457}.
请问一下,最后的报错是什么原因啊
2022年05月20日 13点05分 1
吧务
level 10
数太大了,已经不是提高精度能解决的了。是不是有约束没加?
2022年05月21日 02点05分 2
@asdasd1dsadsa 为什么我按文档的格式加了约束会报错不支持域约束
2025年12月28日 06点12分
比如两个参数都为正?
2022年05月21日 02点05分
@asdasd1dsadsa 我的两个参数β和d,都是正数。具体怎么怎么加约束呢
2022年05月21日 06点05分
@jdts12 文档有说
2022年05月21日 08点05分
level 7
可以试一下拟合的时候把 model 换成 model /. d -> d^2
2022年05月21日 06点05分 3
其实把两个变量的初值换一下就行了
2022年05月21日 07点05分
@hjq447285628 我也偶然发现是这样的,但不知道怎么解释。因为β和d是我用解方程得出的,难道是解方程的值对调了吗?另,把 d 换成d^2是为什么呢?
2022年05月21日 09点05分
吧务
level 15
LZ在stackexchange也问了:
mathematica.stackexchange.com/q/268159/1871
然后,虽然现在吧里没有强制规定,但是,如果你在别处也问了同样的问题,还望把相关链接附一下,免得有人做白工。
2022年06月04日 04点06分 4
1