I assume you mean the derivative (a curve doesn't usually have a slope
--- only a straight line has). gnuplot offers no direct method to access
the derivative. For functions, you can do a numeric approximation like this:
epsilon = 0.001
derivative_of_f = (f(x*(1+epsilon) - f(x*(1-epsilon))) / (2*epsilon*x)
This won't work close to x=0.
For datafiles, you'll have to use methods outside gnuplot. The following
'awk' script does nicely, for columns 1 and 2 as x and y:
#! /bin/awk -f
BEGIN { firstline = 1 }
$0 !~ /^#/ { if (firstline == 1) {
old_x = $1
old_y = $2
firstline = 0
} else {
print (old_x + $1)/2.0, "\t", (old_y - $2)/(old_x - $1), "\t"
old_x = $1
old_y = $2
}
}
You can run it like this, on sufficiently Unix-oid platforms:
plot '< diff.awk yourdatafile' using 1:2
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.