exsonic01
exsonic01

Reputation: 637

gnuplot how to print out derivative value to txt file?

I'm plotting data from several txt files and their derivatives.

data1 = "AAA.txt"
data2 = "BBB.txt"
data3 = "CCC.txt"
data4 = "DDD.txt"

plot data2 u 2:4 w l lt 1 lw 3.5 lc rgb "red" title "b-O", \
     data3 u 2:4 w l lt 1 lw 3.5 lc rgb "blue" title "c-O", \
     data1 u 2:4 w l lt 1 lw 3.5 lc rgb "web-green" title "a-O", \
     data4 u 2:4 w l lt 1 lw 3.5 lc rgb "forest-green" title "d-O", \
     data2 u (dx=$2-x0,x0=$2,$2-dx/2):(dy=$4-y0,y0=$4,dy/dx) smooth sbezier w l lt 1 lw 3.5 lc rgb "orange" title "b-O deri" axes x1y2, \
     data3 u (dx=$2-x0,x0=$2,$2-dx/2):(dy=$4-y0,y0=$4,dy/dx) smooth sbezier w l lt 1 lw 3.5 lc rgb "skyblue" title "c-O deri" axes x1y2, \
     data1 u (dx=$2-x0,x0=$2,$2-dx/2):(dy=$4-y0,y0=$4,dy/dx) smooth sbezier w l lt 1 lw 3.5 lc rgb "light-green" title "a-O deri" axes x1y2, \

I wish to get the slope of the derivatives within a specific range of x. To achieve this, I need to apply a linear fit to derivatives, or I need to print out derivative data to the txt file and apply linear fit.

I really have no idea how can I apply fit to the derivative in Gnuplot. So I wish to print out derivative data to txt files, then apply fit to the derivative data.

I searched for some references, but I couldn't find the way to print out the derivative data to a txt file in Gnuplot... Is this possible to apply the "set print" command to print out derivative data to a txt file in Gnuplot?

Upvotes: 0

Views: 223

Answers (1)

Tom Solid
Tom Solid

Reputation: 2414

I can't reproduce your problem, because you missed to denfine derivate, but:

you can export any plot to datafile, by table. Eg.:

set table 'valami.dat'
plot norm(x)
unset table

Upvotes: 1

Related Questions