gnuplot2010. 3. 20. 14:26
학부 3학년 1학기 전자회로 실험을 할 때 썼던 코드이다.
오실로스코프에서 저장한 데이터를 플롯하는데 사용하였다.
#!/bin/bash

FILES[0]="a.csv 2 limiter Limiting Circuit"
FILES[1]="b.csv 2 clamper Clamper Circuit"
FILES[2]="c.csv 1 doubler Voltage Doubler"
FILES[3]="d.csv 2 tripler Voltage Tripler"

for i in "${FILES[@]}"
do
set -- $i
echo set title \"$4 $5\" > $3.plot
echo set term png >> $3.plot
echo set output \"$3.png\" >> $3.plot
echo set xlabel \"Time\" >> $3.plot
echo set ylabel \"Voltage\" >> $3.plot
echo set datafile separator \",\" >> $3.plot
echo set grid >> $3.plot
echo set key below >> $3.plot


if [ "$2" = "1" ]
then
echo plot \"$1\" u 1:2 with l title \"V_in\", \"$1\" u 1:3 with l title \"V_out\" >> $3.plot
else
echo plot \"$1\" u 1:3 with l title \"V_in\", \"$1\" u 1:2 with l title \"V_out\" >> $3.plot
fi
echo show output >> $3.plot

#echo set term latex >> $3.plot
#echo set output \"$3.tex\" >> $3.plot
#echo replot >> $3.plot
#echo show output >> $3.plot

gnuplot $3.plot

done

exit 0

예제 그림은 하나만


Posted by asdfzxcv