From d7b0a683738537600fd43f326869696b8866e044 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 13 Feb 2013 16:32:12 -0500 Subject: [PATCH] energy.gp: Add gnuplot script and rules to build an energy --- Makefile | 5 ++++- energy.gp | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 energy.gp diff --git a/Makefile b/Makefile index 89dac64..0cc5151 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,7 @@ $(CXX_PROGRAMS): % : $$($$(*)_OBJECTS) # gnuplot plot.gp # where plot.gp was a gnuplot script for plotting data generated by # RUN_PROGRAM. -run: error.png phase.png +run: error.png phase.png energy.png .SECONDEXPANSION: error-%.data: $(PROGRAMS) @@ -163,6 +163,9 @@ phase.data: phase.png: phase.gp phase.data gnuplot "$<" > "$@" +energy.png: energy.gp phase.data + gnuplot "$<" > "$@" + # Pattern rule for compiling object files from C++ source # There is an implicit rule for this in GNU make # http://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html diff --git a/energy.gp b/energy.gp new file mode 100644 index 0000000..8137aa6 --- /dev/null +++ b/energy.gp @@ -0,0 +1,11 @@ +set term png +set termoption enhanced +set title 'Particle energy' +set xlabel 'x' +set ylabel 'V(x) + K(x)' +unset key +k = 10 +b = 1 +V(r) = 0.5 * k * b**2 * exp(-r**2/b**2) +set style data lines +plot V(x) title 'V(r)', for [i=0:13] 'phase.data' index i using 2:6 -- 2.26.2