我试图通过gnuplot在几个点上绘制最佳线条拟合。有三个数据包应该在一个图中,包括每个包的最佳线。到目前为止,这是我的代码:`
#!/usr/bin/gnuplot
#Output Settings
set terminal pdfcairo
set output "Graph_Versuch_2.pdf"
#Graph Settings
set title "Abnahme der Umdrehungsfrequenz"
set xlabel "Zeit in Sekunden"
set xrange [0:60]
set ylabel "Drehzahl in RPM"
set logscale y
#Fit Settings
z(x) = j*exp(p*x)
k(x) = i*exp(o*x)
n(x) = m*exp(v*x)
#Plot Settings
fit z(x) "Werte_1.txt" via p,j
fit k(x) "Werte_2.txt" via i,o
fit n(x) "Werte_3.txt" via m,v
plot "Werte_1.txt" u 1:2 title "Messreihe 1" with points lc rgb 'red' pt 7
ps 0.25, "Werte_2.txt" u 1:2 title "Messreihe 2" with points lc rgb
'green' pt 5 ps 0.25, "Werte_3.txt" u 1:2 title "Messreihe 3" with points
lc rgb 'blue' pt 9 ps 0.25, z(x) with lines lc 'black', k(x) with lines,
n(x) with lines
但是现在有两个问题:第一个问题是,只要我在欧拉号的括号内放一个减号就没有Diagramm(我不知道为什么)和第二个一个事实是,如果我在欧拉数中使用正指数,那么只有一条最合适的线。
如果有人能解释为什么会出现这些问题以及如何解决这些问题,我将非常感激。
数据包:
0 498.4
5 478.6
10 461.9
15 446.6
20 427.1
25 410.1
30 394.1
35 381.1
40 367.4
45 351.5
50 341.5
55 316.4
60 157.4
0 448.8
5 429.7
10 415.6
15 397.8
20 382.4
25 369.0
30 354.7
35 342.1
40 329.9
45 316.1
50 305.7
55 292.8
60 281.7
0 498.6
5 478.8
10 461.2
15 444.0
20 428.2
25 412-8
30 397.9
35 382.6
40 368.8
45 354.9
50 340.8
60 315.9
这是我所包含的部分:
#Fit Settings
z(x) = j*exp(p*x)
k(x) = i*exp(o*x)
n(x) = m*exp(v*x)
#Plot Settings
j = 500
i = 500
m = 500
p = -1
o = -1
v = -1
fit z(x) "Werte_1.txt" via p,j
fit k(x) "Werte_2.txt" via i,o
fit n(x) "Werte_3.txt" via m,v
这就是我得到的错误:
Iteration 0
WSSR : 1.78982e+06 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 3.30143
initial set of free parameter values
p = -1
j = 500
Undefined value during function evaluation
"Plot_1.txt", line 34: