如何使用f(x) = A*(sin(b*x)/(b*x))**2
data.dat文件内容为:
-3.7 0.020505941
-3.6 0.015109903
-3.5 0.010044806
-3.4 0.005648897
-3.3 0.002285005
-3.2 0.000332768
-3.1 0.000179912
-3 0.002212762
-2.9 0.006806212
-2.8 0.014313401
-2.7 0.025055358
-2.6 0.039310897
-2.5 0.057307025
-2.4 0.079210158
-2.3 0.105118386
-2.2 0.135055049
-2.1 0.168963812
-2 0.206705453
-1.9 0.24805647
-1.8 0.292709632
-1.7 0.340276504
-1.6 0.390291948
-1.5 0.442220555
-1.4 0.495464883
-1.3 0.549375371
-1.2 0.603261707
-1.1 0.65640542
-1 0.708073418
-0.9 0.757532157
-0.8 0.804062127
-0.7 0.846972303
-0.6 0.88561423
-0.5 0.919395388
-0.4 0.947791533
-0.3 0.970357695
-0.2 0.986737575
-0.1 0.996671108
0 1
0.1 0.996671108
0.2 0.986737575
0.3 0.970357695
0.4 0.947791533
0.5 0.919395388
0.6 0.88561423
0.7 0.846972303
0.8 0.804062127
0.9 0.757532157
1 0.708073418
1.1 0.65640542
1.2 0.603261707
1.3 0.549375371
1.4 0.495464883
1.5 0.442220555
1.6 0.390291948
1.7 0.340276504
1.8 0.292709632
1.9 0.24805647
2 0.206705453
2.1 0.168963812
2.2 0.135055049
2.3 0.105118386
2.4 0.079210158
2.5 0.057307025
2.6 0.039310897
2.7 0.025055358
2.8 0.014313401
2.9 0.006806212
3 0.002212762
3.1 0.000179912
3.2 0.000332768
3.3 0.002285005
3.4 0.005648897
3.5 0.010044806
3.6 0.015109903
3.7 0.020505941
3.8 0.025925906
我的以下代码:
f(x) = A*(sin(b*x)/(b*x))**2;
A = 1;
b = 1;
fit f(x) "data.dat" u 1:2 via A,b;
plot [x=-3:3] f(x);
我在功能评估期间收到错误未定义的值。
答案 0 :(得分:4)