调试运行ns2 lab13.tcl中遇到的问题

依次执行如下命令

ns lab13_1.tc
set title "Vegas"
set xlabel "time"
set ylabel "cwnd"
set terminal gif
set output "cwnd-Vegas.gif"
plot "cwnd0.tr" with linespoints 1, "cwnd1.tr" with linespoints 

在用plot绘制图形时,出现错误。

错误1: 报错"unexpected or unrecognized token"

错误出现的位置是linespoints后面的1和2,知道它是为了用1和2来绘制不同的颜色,查询表示不同线条颜色的参数"lt"。值为1为紫色,2为绿色,3为蓝色,4为橙色、5为黄色、6为深蓝色、7为红色、8为黑色,大于8的数字对应的颜色与其对8的余数对应的颜色相同。
把命令修改为
plot "cwnd0.tr" with linespoints lt 1, "cwnd1.tr" with linespoints lt 2
执行结果
使用gnuplot观察queue length的变化值

set title "queue length"
set xlabel "time"
set ylabel "packets"
set terminal gif
set output "queue_length.gif"
plot "queue_length-13_1.tr" with lines lt 1

执行结果
执行命令ns lab13_2.tcl
运行结果
使用gnuplot观察cwnd的变化值:

set title "Vegas vs Reno"
set xlabel "time"
set ylabel "cwnd"
set terminal gif
set output "cwnd-Vegas-Reno.gif"
plot "cwnd-vegas.tr" with linespoints lt 1, "cwnd-reno.tr" with linespoints lt 2

执行结果

发布了152 篇原创文章 · 获赞 29 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/happyeveryday62/article/details/103325648