From: W. Trevor King Date: Wed, 13 Feb 2013 21:32:12 +0000 (-0500) Subject: energy.gp: Add gnuplot script and rules to build an energy X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d7b0a683738537600fd43f326869696b8866e044;p=assignment-template.git energy.gp: Add gnuplot script and rules to build an energy --- 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