gnuplot_functions 2.11 KB
write_gnuplot_result() {

# write a gnuplot input file to plot a spice result vs analytic reference result
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE="set output '$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
$OUTPUT_FILE_LINE
set title  '$TITLE'
set xlabel '$XLABEL'
set ylabel '$YLABEL'
set $XSCALE x
plot 'analytic_solution.dat' u 1:2 title 'Analytic solution' w p lc 3,\
     'spice_solution.dat' u 2:3 title 'Spice solution' w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}

write_gnuplot_reference_result() {

# write a gnuplot input file to plot a spice result vs reference spice result
# and the analytic result vs reference analytic result
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE1="set output 'Analytic_$OUTPUT_FILE'"
OUTPUT_FILE_LINE2="set output 'Spice_$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE1=""
OUTPUT_FILE_LINE2=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
set title  '$TITLE'
set xlabel '$XLABEL'
set ylabel '$YLABEL'
set $XSCALE x
$OUTPUT_FILE_LINE1
plot  '../analytic_solution.dat_reference' u 1:2 title 'Reference Analytic solution' w p lc 3,\
      'analytic_solution.dat' u 1:2 title 'Analytic solution' w l lc 1
$PAUSE_LINE
$OUTPUT_FILE_LINE2
plot '../spice_solution.dat_reference' u 2:3 title 'Reference Spice solution' w p lc 3,\
     'spice_solution.dat' u 2:3 title 'Spice solution' w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}

write_gnuplot_plot_bundle() {

# write a gnuplot input file to plot the bundle cross section
# Then run gnuplot with this file as input

if [ $OUTPUT_FILE ]
then
OUTPUT_FILE_LINE="set output '$OUTPUT_FILE'"
PAUSE_LINE=""
else
OUTPUT_FILE_LINE=""
PAUSE_LINE="pause -1"
fi

echo "set term $TERMINAL noenhanced
$OUTPUT_FILE_LINE
set size square
set title  '$TITLE'
set xlabel 'x(m)'
set ylabel 'y(m)'
plot 'conductors.dat' u 1:2 title 'Conductors' w l lc 3,\
     'dielectrics.dat' u 1:2 title 'Dielectrics' w l lc 2,\
     'frame.dat' u 1:2 notitle  w l lc 1
$PAUSE_LINE
" > plot.plt

gnuplot plot.plt

}