12081220+金雨鑫+实验2

更新时间:2023-10-02 07:27:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

杭 州 电 子 科 技 大 学

实 验 报 告

学生姓名:金雨鑫 学 号:12081220 指导教师:吴端坡 实验地点:1教108 一、实验室名称:

二、实验项目名称:2.data link layer simulation 三、实验学时:3 四、实验内容:

1.Draw Figure7.12 and 7.13.

2.Simulation on Performance of Data Link Control Protocols

Using the same assumptions that are used for Figure 7.13 in Appendix 7A, plot line utilization as a function of P, the probability that a single frame is in error for the following error-control techniques: a. Stop-and-wait b. Go-back-N with w=7 c. Go-back-N with w=127 d. Selective reject with w=7 e. Selective reject with w=127

Do all of the preceding for the following values of a: 0.1, 1, 10, 100. Draw conclusions about which technique is appropriate for various ranges of a.

实验时间:周二晚上

七、实验器材(设备、元器件):

PC机一台,装有matlab。

八、实验步骤:

(1)a=0:0.1:1000;

U=utilization(a,1); semilogx(a,U); hold on

U=utilization(a,7); semilogx(a,U); hold on

U=utilization(a,127); semilogx(a,U);

title('Figure 7.12 Sliding-Window Utilization as a Function of a') ylabel('Utilization') xlabel('a')

text(0.7,0.5,' \\leftarrow W=1'); text(8,0.6,' \\leftarrow W=7'); text(130,0.8,' \\leftarrow W=127'); 自编函数代码:

function U=utilization(a,W)

U=1.*(W>=2*a+1)+W./(2*a+1).*(W<2*a+1); end

(2)

a=0:0.1:1000; P=1/1000;

U=stopandwait(a,P); semilogx(a,U,'r'); hold on

U=selective_reject(a,7,P); semilogx(a,U,'g'); hold on

U=gobackn(a,7,P); semilogx(a,U,'b'); hold on

U=selective_reject(a,127,P); semilogx(a,U,'k'); hold on

U=gobackn(a,127,P); semilogx(a,U,'y');

title('Figure 7.13 ARQ Utilization as a Function of a (P = 10-3)') ylabel('Utilization') xlabel('a')

text(0.2,0.2,' Stop-and-wait \\rightarrow');

text(0.23,0.7,' W=7 Go-back-N & \\newline W=7 Selective-reject \\rightarrow');

text(10,0.8,' W=127 \\newline Go-back-N \\rightarrow '); text(110,0.7,' \\leftarrow W=127 \\newline Selective-reject'); 自编函数代码:

function U=stopandwait(a,P) U=(1-P)./(1+2*a); End

function U=selective_reject(a,W,P)

U=(1-P).*(W>=2*a+1)+W.*(1-P)./(2.*a+1).*(W<2*a+1); end

function U=gobackn(a,W,P)

U=(1-P)./(1+2.*a.*P).*(W>=2*a+1)+W.*(1-P)./(2.*a+1)./(1-P+W.*P).*(W<2*a+1); end

(3) figure

set (gcf,'Position',[300,0,800,800], 'color','w') a=[0.1, 1, 10, 100]; for i = 1:4 subplot(2,2,i) lab2_draw(a(i))

title(strcat('a=',num2str(a(i)))) end

自编函数代码:

function lab2_draw(a) P=0:0.1:1000; U=stopandwait(a,P); semilogx(P,U,'r'); hold on

U=selective_reject(a,7,P); semilogx(P,U,'g'); hold on

U=gobackn(a,7,P); semilogx(P,U,'b'); hold on

U=selective_reject(a,127,P); semilogx(P,U,'k'); hold on

U=gobackn(a,127,P); semilogx(P,U,'y'); ylabel('Utilization') xlabel('P')

legend('Stop-and-wait','Go-back-N with w=7 ','Go-back-N with w=127 ','Selective reject with w=7 ','Selective reject with w=127 ',3) end

九、实验数据及结果分析:

。a=0.1时,W=7或者127都是大于2a+1;

a=1时,W=7或者127都是大于2a+1;

a=10时,则选择拒绝和返回N都是一个分段函数。

a=100时,则选择拒绝和返回N都是一个分段函数。

本文来源:https://www.bwwdw.com/article/4i5d.html

Top