|
From: Dieter J. <die...@t-...> - 2008-04-05 20:11:17
|
Dear listmembers,
I recently had the need to integrate a function for some reason. Therefore I
wrote a small script that takes the data out of a gnuplot-generated table in
a file and calculates the linearly interpolated area between two consecutive
x-values of the table I wrote with gnuplot.
To use this from within gnuplot, I do the following:
say, the function is x*x and I want to integrate between 0 and 1:
set xrange[0:1]
set samples 1000
set table "dummy.dat"
plot x*x
set output
set terminal X11
A=system ("integrate dummy.dat")
print A
The script "integrate" reads the table and outputs the integral value as
described above. The assignment of the output of the system-command
A=system(... results in what I want: I have the integral value "at hand"
within gnuplot.
Now I thought about skipping the intermediate step to write to a file:
set table
plot x*x
set output "| integrate -"
This results in the integral value being printed on the screen. However, I do
not know how to "put this output" into a variable like the return value of
the system() command can be assigned to.
Does anybody have an idea whether and how this can be achieved?
Thank you very much for looking into this,
take care
Dieter Jurzitza
--
-----------------------------------------------------------
|
\
/\_/\ |
| ~x~ |/-----\ /
\ /- \_/
^^__ _ / _ ____ /
<°°__ \- \_/ | |/ | |
|| || _| _| _| _|
if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------
|