Below is the version that uses arrays from Gnuplot 5.1. Using arrays allows you to calculate multiple differences in a single instance of Gnuplot.
array Z[128] do for [i=1:128] { Z[i] = NaN } diff(i, x) = (y = x - Z[i], Z[i] = x, y)
i is the instance index that needs to be incremented for each use. For example,
plot "file1.csv" using 1:(diff(1,$2)) using line, \ "file2.csv" using 1:(diff(2,$2)) using line
Jaakko
source share