Wolfram mathematica 用mathematica拟合正弦数据之和

Wolfram mathematica 用mathematica拟合正弦数据之和,wolfram-mathematica,curve-fitting,trigonometry,Wolfram Mathematica,Curve Fitting,Trigonometry,为什么每个人 mathematica脚本有一个小问题,我需要它用3个正弦函数之和拟合数据点: fit = NonlinearModelFit[Data,a1*Sin[b1*x + c1] + a2*Sin[b2*x + c2] + a3*Sin[b3*x + c3], {a1, b1,c1, a2, b2, c2, a3, b3, c3}, x] 我得到这个错误: NonlinearModelFit::cvmit: Failed to converge to the requested acc

为什么每个人

mathematica脚本有一个小问题,我需要它用3个正弦函数之和拟合数据点:

fit = NonlinearModelFit[Data,a1*Sin[b1*x + c1] + a2*Sin[b2*x + c2] + a3*Sin[b3*x + c3], {a1, b1,c1, a2, b2, c2, a3, b3, c3}, x]
我得到这个错误:

NonlinearModelFit::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations
我尝试过使用不同的起始值,并将MaxIteration设置为10.000。。。 也许这不是进行这种试衣的正确方式。有人对此有想法吗


谢谢

也许您的数据太差了,但它与一个好的示例配合得很好:

data = Table[{x, Sin[ x + .3] + 2 Sin[1.2 x] + 3 Sin[1.5 x + .5]}, 
             {x, .01,  8 Pi, .001}];
fit = NonlinearModelFit[data, 
          a1*Sin[b1*x + c1] + a2*Sin[b2*x + c2] + a3*Sin[b3*x + c3], 
          {a1, b1, c1, a2, b2, c2, a3, b3, c3}, x]

Show[ListPlot[data], Plot[fit[x], {x, 0, 8 Pi}, PlotStyle -> Red], Frame -> True]

问题是我不能增加数据的数量。。。在32个CPU上计算每个点需要3天…:D我有20个数据点还有其他想法吗?@B.jour有20个数据点和9个自由参数,我想你有大麻烦了: