Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gnuplot:拟合循环问题_Gnuplot_Curve Fitting_Data Fitting - Fatal编程技术网

Gnuplot:拟合循环问题

Gnuplot:拟合循环问题,gnuplot,curve-fitting,data-fitting,Gnuplot,Curve Fitting,Data Fitting,我需要用高斯函数拟合一些数据,我用一些初始参数定义了这个函数。我有10个.gr文件需要拟合,代码告诉程序进行拟合循环,然后根据数据的变化绘制一个.gif文件(每个文件对应不同的时间)。该程序工作正常,最后得到了.gif和.dat文件,但它跳过了一些.gr文件。 代码是: #Define the sequence number from ARG1 to variable id id = ARG1 #Here we generate filename from sequence number we

我需要用高斯函数拟合一些数据,我用一些初始参数定义了这个函数。我有10个.gr文件需要拟合,代码告诉程序进行拟合循环,然后根据数据的变化绘制一个.gif文件(每个文件对应不同的时间)。该程序工作正常,最后得到了.gif和.dat文件,但它跳过了一些.gr文件。 代码是:

#Define the sequence number from ARG1 to variable id
id = ARG1

#Here we generate filename from sequence number we passed to this script by command call.
filename = sprintf("FeCoBSiNbCu%04d.gr",int(id))

#Command to fit the peak with background
fit [3.68:5.45] f45(x) filename u 1:2 via x4,A4,w4,x5,A5,w5,a0,a1

#Now we write all results into formatted string:
entry1 = sprintf("%d\t%.3f\t%.3f\t%.1f\t%.1f\t%.3f\t%.3f\t",int(id),x4,x4_err,A4,A4_err,w4,w4_err)
entry2 = sprintf("%.3f\t%.3f\t%.1f\t%.1f\t%.3f\t%.3f\t",x5,x5_err,A5,A5_err,w5,w5_err)

print entry1
print entry2

plot filename u 1:($0 >=0 ? $2 : 1/0) w p pt 6 ps 1 lc rgb "black" t "Experimental data",\
     filename u 1:((3.68 <= $1 && $1 <= 5.45) ? f45($1) : 1/0) w l lt 1 lw 3 lc rgb "red" t "Fitted data"
#定义从ARG1到变量id的序列号
id=ARG1
#在这里,我们根据通过命令调用传递给该脚本的序列号生成文件名。
filename=sprintf(“FeCoBSiNbCu%04d.gr”,int(id))
#命令使峰值与背景匹配
通过x4、A4、w4、x5、A5、w5、a0、a1安装[3.68:5.45]f45(x)文件名u 1:2
#现在,我们将所有结果写入格式化字符串:
entry1=sprintf(“%d\t%.3f\t%.3f\t%.1f\t%.1f\t%.3f\t%.3f\t”,int(id),x4,x4,x4错误,A4,A4错误,w4,w4错误)
entry2=sprintf(“%.3f\t%.3f\t%.1f\t%.1f\t%.3f\t%.3f\t”,x5,x5\u错误,A5,A5\u错误,w5,w5\u错误)
打印入口1
打印入口2
绘图文件名u 1:($0>=0?$2:1/0)w p pt 6 ps 1 lc rgb“黑色”t“实验数据”\

文件名u 1:((3.68如何调用脚本?如果在
id=ARG1
之后添加
print id
print filename
filename=…
之后添加
print filename
,它是否会打印预期的输出?您没有8和9,是否可能出于某种原因,八进制数(只有字母0到7)起作用?它没有使用的是000因为某些原因,我不喜欢。现在它适用于没有零的数字