Skip to content
Snippets Groups Projects
Commit 17403d63 authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

Start of organising examples for the last part of the Uebung.

parent 5eeb282f
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
# one dimension, and then make a histogram of the distribution
tmp_input=in1
. general_stuff
cat > $tmp_input <<EOF
ini_temp 0.1
final_temp 0.1
n_step 100000
x_ini 0
x_delta 0.5
seed 1637
foutname $tmp_input.csv # This will store all the information from a run.
EOF
$exe $tmp_input
cat > $tmp_input <<EOF
df <- read.csv(file="in1.csv", header=F, col.names=c("step", "temp","function_value", "x1"))
png(filename="plots/ex1.png")
plot (x = df\$step, y = df\$function_value, xlab = "step", ylab = "f value")
png(filename="plots/ex1_hist.png")
hist (df\$x1, xlab = "x coord", main = "", freq = F, breaks = 60)
dev.off()
EOF
R --no-save --no-echo < $tmp_input
# There are some common things we will use in any script we have for plotting.
exe_dir=../bin
exe=$exe_dir/ackley_nogfx
plot_dir=plots
bailout () {
echo BROKEN
exit 1
}
if ! [ -x $exe ] ; then
(cd ..; make ) || bailout
fi
if ! [ -d $plot_dir ] ; then
mkdir $plot_dir || bailout
fi
\ No newline at end of file
df <- read.csv(file="in1.csv", header=F, col.names=c("step", "temp","function_value", "x1"))
png(filename="plots/ex1.png")
plot (x = df$step, y = df$function_value, xlab = "step", ylab = "f value")
png(filename="plots/ex1_hist.png")
hist (df$x1, xlab = "x coord", main = "", freq = F, breaks = 60)
dev.off()
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment