gnuplot错误:“0”;格式错误字符“;尽管;设置数据文件分隔符";

gnuplot错误:“0”;格式错误字符“;尽管;设置数据文件分隔符";,gnuplot,Gnuplot,我不是英语母语,所以很抱歉我的英语很差 我在MacOSX上使用gnuplot 5.0.0并执行下一个代码 plot "psd.dat" using 1:2 set autoscale fix set format x "%d" set format y "%.1f" f(x) = a*x+b a = 50000 b = 0 fit [-500:500] f(x) "psd.dat" using 1:(($2 - $3)/($2 + $3)) via a,b plot "psd.dat" usi

我不是英语母语,所以很抱歉我的英语很差

我在MacOSX上使用gnuplot 5.0.0并执行下一个代码

plot "psd.dat" using 1:2
set autoscale fix
set format x "%d"
set format y "%.1f"
f(x) = a*x+b
a = 50000
b = 0
fit [-500:500] f(x) "psd.dat" using 1:(($2 - $3)/($2 + $3)) via a,b
plot "psd.dat" using 1:(($2 - $3)/($2 + $3)*a+b) w p, f(x)
set terminal tikz
set output "psd.tex"
replot
set terminal pdf
set output "psd.pdf"
replot
set terminal aqua
我的psd.dat文件的内容如下:

-500 14.51 15.12
-450 14.54 15.08
-400 14.57 15.04
-350 14.59 15.02
-300 14.60 14.96
-250 14.66 14.95
-150 14.71 14.90
-100 14.76 14.87
-50 14.79 14.83
0 14.85 14.85
50 14.84 14.78
100 14.89 14.74
150 14.93 14.72
200 14.98 14.70
250 15.02 14.68
300 15.05 14.66
350 15.12 14.64
400 15.16 14.63
450 15.21 14.62
500 15.26 14.60
但我有下一个错误

Bad format character
我提到并执行:

set datafile separator whitespace
但即使在我执行它之后,我也有“坏格式字符”错误。 我认为我所做的是非常基本的,所以我不知道为什么我会有这个错误。 你有什么办法解决这个问题吗?请告诉我

附言。 解决此错误后,我希望执行下一个代码

plot "psd.dat" using 1:2
set autoscale fix
set format x "%d"
set format y "%.1f"
f(x) = a*x+b
a = 50000
b = 0
fit [-500:500] f(x) "psd.dat" using 1:(($2 - $3)/($2 + $3)) via a,b
plot "psd.dat" using 1:(($2 - $3)/($2 + $3)*a+b) w p, f(x)
set terminal tikz
set output "psd.tex"
replot
set terminal pdf
set output "psd.pdf"
replot
set terminal aqua

这与你的数据无关

当您输入格式字符串时(使用
set format
),Gnuplot不会对其求值,而仅在进行下一次绘图时才求值


“%d”不是有效的格式字符串,因此出现错误。

它与数据无关

当您输入格式字符串时(使用
set format
),Gnuplot不会对其求值,而仅在进行下一次绘图时才求值


“%d”不是有效的格式字符串,因此出现错误。

脚本第二行中的格式字符串“%d”不正确。数据或数据文件分隔符没有问题。选中“帮助格式说明符”。顺便说一句,你不应该给fit参数一个零的起始值。像您这样的线性函数无论如何都会收敛,但对于更复杂的拟合,这可能会出错。脚本第二行中的格式字符串“%d”不正确。数据或数据文件分隔符没有问题。选中“帮助格式说明符”。顺便说一句,你不应该给fit参数一个零的起始值。像您这样的线性函数无论如何都会收敛,但对于更复杂的拟合,这可能会出错。脚本第二行中的格式字符串“%d”不正确。数据或数据文件分隔符没有问题。选中“帮助格式说明符”。顺便说一句,你不应该给fit参数一个零的起始值。像您这样的线性函数无论如何都会收敛,但对于更复杂的拟合,这可能会出错。