NS2 模擬產生 .tr 追蹤檔,需透過 awk 擷取兩欄資料 (如時間、吞吐量),再餵給 gnuplot 繪圖。
ns your.tcl 產生 out.tr。awk '{print $2, $6}' out.tr > plot.datplot.gp:set terminal png size 800,600
set output "throughput.png"
set xlabel "Time (s)"
set ylabel "Throughput (Mbps)"
plot "plot.dat" using 1:2 with lines title "Throughput"
gnuplot plot.gp。command not found:確認已安裝 gnuplot 套件 (sudo apt install gnuplot)。plot.dat 是否有資料、欄位索引是否正確。plot.gp 加入 set encoding utf8 並確保終端機支援。參考完整教學:Linux IDC Gnuplot 入門。