gpt4 book ai didi

gnuplot - 尝试绘制单个值时的奇怪行为

转载 作者:行者123 更新时间:2023-12-01 03:51:00 25 4
gpt4 key购买 nike

我正在使用以下 Gnuplot 脚本:

#####  Definitions  ####
a=0.3
s0=10.
s1=-9.999
r1u(x)=-exp(x)*(-1+a+a*exp(x))/((1+exp(x))**3)
r2u(x)=exp(x)*(1-exp(x))*(-1+a+a*exp(x))/((1+exp(x))**4)
f1(c,d)=s0*c*(1-2*a)/2. + s1*r1u(d)
f2(c,d)=1./(3.*c) - s0*c/6. + s1*r2u(d)
dummyx(z)=25.
dummyy1(z)=.08
dummyy2(z)=.06

##### Prologue #####
clear
reset

###### Plot data #####
set zeroaxis
set key title 'plot of dw/dt'
plot '019999.rrp' using 1:(f2(($4),($5))) with linespoints linewidth 2 notitle
pause -1
stats '019999.rrp' using 5 nooutput
do for [i=0:int(STATS_records-1)] {
reset
set term x11 1
set key title '-x0/w at t'.i.' and its position on the "source term" curve'
set xrange [STATS_min:STATS_max]
set label 1 sprintf("t = %3.0f",i) at 25,.04
set label 2 'w is' at 19,.08
set label 3 'dw/dt is' at 19,.06
plot '019999.rrp' every ::i::i:1 using 5:(r1u($5)) linewidth 5 notitle,\
'019999.rrp' every ::i::i:1 using (dummyx($1)):(dummyy1($1)):4 with labels notitle,\
'019999.rrp' every ::i::i:1 using (dummyx($1)):(dummyy2($1)):(f2(($4),($5))) with labels notitle,\
r1u(x) with lines lw 2 notitle
pause -1
}

最后一个 f2(($4),($5))不做它应该做的。它只是绘制 ($5) .然而第一个 f2(($4),($5))作品。

绘制的文件在这里: http://we.tl/SPX4ykaX4j .我不知道提供链接是否是一个好习惯,所以这里是这个文件的头部,足以重现错误。
0.0000000E+00  -15.00000      -60.00000      0.4472136       33.54102    
0.2500000 -14.77640 0.8944144 0.4472048 33.04168
0.5000000 -14.55279 0.8944079 0.4472023 32.54186
0.7500000 -14.32919 0.8944058 0.4472016 32.04191
1.000000 -14.10559 0.8944051 0.4472014 31.54192
1.250000 -13.88199 0.8944049 0.4472013 31.04193
1.500000 -13.65839 0.8944048 0.4472013 30.54193
1.750000 -13.43479 0.8944047 0.4472013 30.04193
2.000000 -13.21119 0.8944047 0.4472013 29.54193
2.250000 -12.98759 0.8944047 0.4472013 29.04193
2.500000 -12.76398 0.8944047 0.4472013 28.54192
2.750000 -12.54038 0.8944046 0.4472012 28.04193
3.000000 -12.31678 0.8944047 0.4472013 27.54192
3.250000 -12.09318 0.8944047 0.4472013 27.04192
3.500000 -11.86958 0.8944047 0.4472013 26.54192
3.750000 -11.64598 0.8944047 0.4472013 26.04192
4.000000 -11.42238 0.8944047 0.4472013 25.54192
4.250000 -11.19878 0.8944047 0.4472013 25.04192
4.500000 -10.97517 0.8944047 0.4472013 24.54191
4.750000 -10.75157 0.8944047 0.4472013 24.04191
5.000000 -10.52797 0.8944047 0.4472013 23.54191
5.250000 -10.30437 0.8944046 0.4472012 23.04191
5.500000 -10.08077 0.8944047 0.4472013 22.54191
5.750000 -9.857169 0.8944047 0.4472013 22.04191
6.000000 -9.633568 0.8944047 0.4472013 21.54191
6.250000 -9.409966 0.8944047 0.4472013 21.04191
6.500000 -9.186366 0.8944047 0.4472013 20.54190
6.750000 -8.962765 0.8944047 0.4472013 20.04190
7.000000 -8.739163 0.8944047 0.4472013 19.54190
7.250000 -8.515562 0.8944047 0.4472013 19.04190
7.500000 -8.291961 0.8944047 0.4472013 18.54190
7.750000 -8.068360 0.8944046 0.4472012 18.04190
8.000000 -7.844759 0.8944047 0.4472013 17.54190
8.250000 -7.621158 0.8944047 0.4472013 17.04190
8.500000 -7.397556 0.8944047 0.4472013 16.54189
8.750000 -7.173955 0.8944047 0.4472013 16.04189
9.000000 -6.950354 0.8944047 0.4472013 15.54189
9.250000 -6.726753 0.8944047 0.4472013 15.04189
9.500000 -6.503151 0.8944047 0.4472013 14.54189

最佳答案

如果您使用 sprintf,问题已解决格式化函数值:

...
plot '019999.rrp' every ::i::i using (dummyx($1)):(dummyy2($1)):(sprintf("%g", f2(($4),($5)))) with labels notitle
...

可以使用以下简化示例重现相同的错误 (?):
set samples 11
set xrange [0:10]
f(x,y) = x+y
unset key

set multiplot layout 2,1
plot '+' using 1:1:(f($1,$1)) with labels
plot '+' using 1:1:(sprintf("%g", f($1,$1))) with labels
unset multiplot

我不知道,这是否可以被视为一个错误。我举报为 #1368 Conversion of numerical expressions in string columns .

enter image description here

关于gnuplot - 尝试绘制单个值时的奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22814391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com