Search code examples
gnuplotdummy-variable

GNUPLOT - problems with "set dummy"


Hey i want to plot some functions but have problems with my dummy variables. Everytime i want to plot my second graphic gnuplot says that dummy M or x is not defined but i don't know why. Its not neccesary to have different dummy variables but it would help would help to keep track of things. Otherwise I want understand why my code doesn't work for further plots. For me the dummy variable is only a variable that is used for every point on x axis on my plot. Maybe I'm wrong? I hope anyone can help me?

reset
set term qt

d = 0.01
G = 81.0E9
k = 2.02
g = 9.81
E = 210.0E9
v = 0.28
A = 0.12 * 0.12
tau_max = 100.0E6
U0 = 3.0

IP = pi * d / 32.0

#Plot und Berechnung für die Wägezelle

set title "Wägezelle - U_B/U_0" font "times new roman, 30"
set xrange [0:10.0]
set yrange [0:45.0]
set xlabel "m [kg]" font "times new roman, 25"
set ylabel "U_{Bsoll}/U_0 * 10^9" offset -5 font "times new roman, 25"
set xtics nomirror font "times new roman, 20"
set ytics 5 font "times new roman, 20"

set lmargin 15
set bmargin 5

set dummy m

y(m) = m * g * (1 + v) * k / 2 / E / A * 1E9

plot \
y(m) w l lc "red" lw 2 notitle

pause mouse any

#Plot und Berechnung Torsionsstab

set title "Drehmoment" font "times new roman, 30"
set xrange []
set yrange []
set xlabel "" font "times new roman, 25"
set ylabel "" font "times new roman, 25"
set xtics font "times new roman, 20"
set ytics font "times new roman, 20"

set dummy ,M,x

tau(M) = M * d / 2 / IP
epsilon(M) = M * d / 4 / G / IP

 Ub(x) = k * epsilon(M) * U0

plot \
epsilon(M) w l lc "blue" title "{/symbol e}_(M)",\
tau(M) w l lc "red" title "{/symbol t}_(M)"

pause mouse any

#plot \
#Ub(x) w l

pause mouse any

Solution

  • As I understand help dummy you only can set one dummy variable for plot, e.g. plot x and two variables for splot, e.g. splot x*y. For parametric mode the standard dummy variables for plot are t and for splot u,v.

    From help dummy:

    By default, gnuplot assumes that the independent, or "dummy", variable for the plot command is "t" if in parametric or polar mode, or "x" otherwise. Similarly the independent variables for the splot command are "u" and "v" in parametric mode (splot cannot be used in polar mode), or "x" and "y" otherwise.

    It may be more convenient to call a dummy variable by a more physically meaningful or conventional name.

    Earlier you set set dummy m and with set dummy ,M,x you were trying to set 3 dummy variables. And hence plot M will not work, because m is still the first dummy variable and anyway for plot you can use only one.