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

时间:2015-06-06 01:59:35

标签: gnuplot

我对英语不是原生的,对不起我的英语很差。

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

plot "psd.dat" using 1:2

我的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

我提到gnuplot error: Bad format character | stackoverflow并执行:

set datafile separator whitespace

但即使在我执行它之后,我也有“Bad format character”错误。 我认为我所做的是非常基本的,所以我不知道为什么我有这个错误。 你有什么想法解决它吗?请告诉我。

P.S。 解决此错误后,我想执行下一个代码。

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

1 个答案:

答案 0 :(得分:0)

它与您的数据无关。

当您输入格式字符串时(使用set format),Gnuplot不会评估格式字符串,但仅在下一个绘图时进行评估。

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