# 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)
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
--- /dev/null
+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