gnuplot - Gnuplot:拟合循环问题
问题描述
我需要用我用一些初始参数定义的高斯函数来拟合一些数据。我有 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"
所以我用 4 位数字调用我拥有的所有文件,FeCoBSiNbCu%04d.gr
但不考虑 0008 和 0009,而是在两种情况下都使用 0000。
我应该怎么办?
解决方案
推荐阅读
- python-3.x - Python:并行运行嵌套循环,2D移动窗口
- android - Cordova 无法构建 Android
- ios - CloudKit iOS: user can't delete application data
- instagram - Get authorized user's profile picture (Instagram Basic Display API)
- javascript - 在项目列表上切换最喜欢的项目 - 我如何在不使用提交的情况下由用户自动保存项目
- python - 使用 Python 抓取数据属性时遇到问题
- bash - Anaconda 在 Red Hat 7.7 系统上安装失败
- python - Django DictReader 更改名称 [""] == " " 中的 " " 值无
- php - 我怎样才能替换“;” 对于“,”,在一个奇怪的 CSV 文件中
- android - 父样式取决于构建变体