如何在Gnuplot中拟合f(x)=a*sin^2(b*x^2+;c)

如何在Gnuplot中拟合f(x)=a*sin^2(b*x^2+;c),plot,gnuplot,wolfram-mathematica,curve-fitting,Plot,Gnuplot,Wolfram Mathematica,Curve Fitting,我必须将f(x)=asin^2(bx^2+c)拟合到带有测量值的图中: 30.007 36 0.0027 94 0.0026 124 0.0025 153 0.0024 185 0.0022 213 0.0021 273 0.0021 285 0.0022 309 0.0025 318 0.0027 327 0.003 327 0.0031 358 0.0044 390 0.007

我必须将f(x)=asin^2(bx^2+c)拟合到带有测量值的图中:

30.007 36 0.0027 94 0.0026 124 0.0025 153 0.0024 185 0.0022 213 0.0021 273 0.0021 285 0.0022 309 0.0025 318 0.0027 327 0.003 327 0.0031 358 0.0044 390 0.0071 407 0.0096 451 0.0191 477 0.026 510 0.04 543 0.0532 566 0.0645 598 0.0778 623 0.0875 641 0.091 687 0.089 713 0.079 738 0.065 779 0.035 801 0.016 824 0.007 848 0.0037 872 0.0085 888 0.016 906 0.033 915 0.041 936 0.057 942 0.06 954 0.069 974 0.079 991 0.084 1000 0.085

samebody能帮我把曲线拟合到图表上吗?提前谢谢你


我得到的是:

为了得到一个好的拟合,总是提供一些最佳猜测初始值。 我想如果
sin()
的参数大致在-pi到+pi的范围内,这可能有助于整个拟合过程,这就是为什么
b
的猜测值的顺序是
1e-6

代码:

###  fit sin(x)**2 function
reset session

$Data <<EOD
3    0.007
36   0.0027
94   0.0026
124  0.0025
153  0.0024
185  0.0022
213  0.0021
273  0.0021
285  0.0022
309  0.0025
318  0.0027
327  0.003
327  0.0031
358  0.0044
390  0.0071
407  0.0096
451  0.0191
477  0.026
510  0.04
543  0.0532
566  0.0645
598  0.0778
623  0.0875
641  0.091
687  0.089
713  0.079
738  0.065
779  0.035
801  0.016
824  0.007
848  0.0037
872  0.0085
888  0.016
906  0.033
915  0.041
936  0.057
942  0.06
954  0.069
974  0.079
991  0.084
1000 0.085
EOD

a=0.1
b=4e-6
c=0.01
f(x) = a*sin(b*x**2 + c)**2

set fit nolog
fit f(x) $Data u 1:2 via a,b,c

plot $Data u 1:2 w p pt 7 title "Data", \
     f(x) w l lc rgb "red"
### end of code
Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 0.0896193        +/- 0.002625     (2.929%)
b               = 5.0613e-06       +/- 6.487e-08    (1.282%)
c               = -0.471368        +/- 0.03562      (7.557%)

您的数据就是这样,还是分为两列?请始终发布您尝试过的代码。