1.利用NS工具setdest生成移动场景文件,在ns-2.30/indep-utild/cmu-scen-gen/setdest目录下输入命令:
./setdest –n 100 –p 0 –M 30 –t 400 -x 1000 –y 1000 > scence-100n-0p-30M-400t-1000
2.用gnuplot来画图:
(1)cbr数据流的吞吐量
dengjunyi@dengjunyi-desktop:~/ns-allinone-2.30/ns-2.30/gpsr$ gnuplot
gnuplot> set title "cbrthroughput : scene-100n-0p-30M-400t-500/AGT/0.9s"
gnuplot> set xlabel "simulation time : s"
gnuplot> set ylabel "cbrthroughput : kb/s"
gnuplot> plot "cbrthroughput.dat" with linespoints
gnuplot> plot "cbrthroughput.dat" with lines
图样(Style):gnuplot描绘数据资料图形是以读入档桉中的座标值后,以图样绘上。而描绘函数图形是计算若干点的函数值后,以某种图样将函数值绘上。一般是取样 100 点及採取线条作为图样。GNUPLOT 可提供 9 种图样,分别是
1. lines : 将相邻的点以线条连接。如 plot sin(x) with lines。
2. points : 将每一点以一符号绘上。如 plot sin(x) with points
3.
linespoints : 同时具有 lines 及 points 的功能。如 plot sin(x)
with linespoints。
4. impulses : 将每一点画一垂直线至 X 轴。如 plot sin(x) with impulses。
5. dots : 将每一点绘一细点。如 plot sin(x) with dots。
6.
steps : 以垂直线及水平线各一条来连接两点,形成梯形。如连接
(x1,y1),(x2,y2)两点,以(x1,y1)到(x2,y1)和(x2,y1)到(x2,y2) 两线段连接。如 plot sin(x)
with steps。
7.
errorbars : 对每一点座标值 (x,y),画一由 (x,ylow) 至 (x,yhigh)
的线段。并在线段两端做上 tic mark。如plot sin(x) with errorbars。
8.
boxes : The boxes style draws a box centred about
the given x coordinate from the yaxis to the given y coordinate.如plot
sin(x) with boxes。
9.
boxerrorbars : 组合 errorbars 与 boxes 两者功能。如 plot
sin(x) with boxerrorbars。