Here’s an example script to calculate stuff in gnuplot. gnuplot is capable of many functions of the c programming language such as sin(x) erf(x). This is easy to extend since it is possible to define functions and perform logic.
Save this into a file calc.gnu
and run with with command > gnuplot calc.gnu
# gnuplot script by Mathew Peet # 18 February 2007 # Example script to calculate something # A = 1 B = 2 Answer = A + B print "The answer: ", Answer
This could be used in conjunction with regression of data to do all sort of useful stuff.
List of supported functions
In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC may be plotted. The precedence of operators is determined by the specifications of the C programming language.
The supported functions include:
abs(x), acos(x), asin(x), atan(x), cos(x), cosh(x), erf(x), exp(x), inverf(x), invnorm(x), log(x), log10(x), norm(x), rand(x), sgn(x), sin(x), sinh(x), sqrt(x), tan(x), tanh(x).
I saw your postings regarding Gnuplot, and thought you might be interested to know that there is now a book on it: “Gnuplot in Action”. You can pre-order it directly from the publisher: Manning: Gnuplot in Action.
If you want to learn more about the book and the author, check out my book page at Principal Value – Gnuplot in Action.
Let me know if you are interested in a review copy.