计网实验datalinklayersimulation.docx

上传人:b****7 文档编号:10671636 上传时间:2023-02-22 格式:DOCX 页数:8 大小:163.39KB
下载 相关 举报
计网实验datalinklayersimulation.docx_第1页
第1页 / 共8页
计网实验datalinklayersimulation.docx_第2页
第2页 / 共8页
计网实验datalinklayersimulation.docx_第3页
第3页 / 共8页
计网实验datalinklayersimulation.docx_第4页
第4页 / 共8页
计网实验datalinklayersimulation.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

计网实验datalinklayersimulation.docx

《计网实验datalinklayersimulation.docx》由会员分享,可在线阅读,更多相关《计网实验datalinklayersimulation.docx(8页珍藏版)》请在冰豆网上搜索。

计网实验datalinklayersimulation.docx

计网实验datalinklayersimulation

计网实验data-link-layer-simulation

 

 

————————————————————————————————作者:

————————————————————————————————日期:

 

 

《计算机通信与网络实验》

 课程实验报告

实验二:

2.data linklayersimulation

实验名称:

2.datalinklayersimulation

1.实验内容

1.DrawFigure7.12and7.13.

2.Simulationon PerformanceofDataLinkControl Protocols 

Usingthesameassumptionsthatareused forFigure7.13inAppendix 7A,plot lineutilizationasafunction ofP,theprobabilitythatasingle frameisinerrorforthe followingerror-controltechniques:

 

a.Stop-and-wait

b.Go-back-Nwith w=7

c.Go-back-Nwith w=127

d. Selectiverejectwithw=7

e.Selectivereject withw=127

Do alloftheprecedingfor thefollowingvaluesof a:

0.1, 1,10,100.Drawconclusions aboutwhichtechniqueis appropriateforvariousrangesofa.

2.实验结果

A=0.1

A=1

A=10

A=100

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

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

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

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

 

3.实验程序

Figure7.12

a=0:

0.1:

1000;

W = [1,7,127];

forj=1:

3

  fori =1:

length(a)

  ifW(j)>=2*a(i)+1

    U(i)=1;

else

      U(i)=W(j)/(2*a(i)+1);

  end

  end

  ifj==1

   W1=U;

 end

  ifj==2

W7=U;

  end

 ifj == 3

W10=U;

end

end

plot(a,W1);

holdon;

plot(a,W7);

plot(a,W10);

set(gca,'xscale','log');

axis([0.1100001]);

 

Figure7.13

a = 0:

0.1:

1000;

W=[1,7,127,127];

P=10^(-3);

forj=1:

 fori=1:

length(a)

 ifW(j) ==1

   U(i)=(1-P)/(1+2*a(i));

  end

    ifW(j)==7

  if W(2)>=2*a(i)+1

   U(i)= 1-P;

    else

  U(i) = W(j)*(1-P)/(2*a(i)+1);

    end

end

  ifW(j)==127

   ifW(j)>=2*a(i)+1

   U(i)=(1-P)/(1+2*a(i)*P);

    Y(i) =1-P;

  else

U(i)= W(j)*(1-P)/((2*a(i)+1)*(1-P+W(j)*P));

   Y(i)= W(j)*(1-P)/(2*a(i)+1);

  end

 end

 ifj==1

  W1=U;

end

ifj==2

 W7=U;

end

 if j==3

  W10= U;

  end

  ifj == 4

  W=Y;

 end

end

end

plot(a,W1);

holdon;

plot(a,W7);

plot(a,W10);

plot(a,W);

set(gca,'xscale','log');

axis([0.11000 01]);

 

2、Draw

functionU=stopandwait(a,P)  

U=(1-P)./(1+2*a);

end

functionU=selective_reject(a,W,P)

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

end

functionU=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

functionlab2_draw(a)

P=0:

0.1:

1000;

U=stopandwait(a,P);

semilogx(P,U,'r');

holdon

U=selective_reject(a,7,P);

semilogx(P,U,'g');

holdon

U=gobackn(a,7,P);

semilogx(P,U,'b'); 

hold on

U=selective_reject(a,127,P);

semilogx(P,U,'k');holdon 

U=gobackn(a,127,P);

semilogx(P,U,'y'); 

ylabel('Utilization') ;

xlabel('P');

legend('Stop-and-wait','Go-back-Nwithw=7 ','Go-back-N withw=127','Selectiverejectwithw=7','Selectiverejectwithw=127 ',3)

end

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1