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); //U=(1-p)/(1+2p) when w>=2a+1
U=w(1-p)/(2a+1)(1-p+wp)
end Project(3)
figure
set (gcf,'position',[300,0,800,800],'color','w') //
当前Figure对象的句柄值
a=[0.1, 1,10,100]; for i=1:4
subplot(2,2,i) lab2_draw(a(i))
title(stract('a=',num2str(a(i)))) // draw four different
lines
end
function lab2_draw //the formula to
draw the first line
p=0:0.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'); 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
四、 实验结果分析
(1)
This graph shows the maximum utilization achievable for window sizes of 1, 7 127.A window size of 1 corresponds to stop and wait, in which shows when after sending a frame , the sender have to wait an acknowledge to send anther frame. In this condition , when a>>the time of sending ,we can see it the utilization is very low. A window size of 7 is adequate for many application, as it has pretty big buffing area, which can increase the rate of utilization. A window size of 127 is adequate for larger values of a.
(2)
We have ignore errors in acknowledgement frames and ,in the case of go-back-N, errors in retransmitted frames other than the frame initially in error.as a result ,when a>>t ,the efficiency of selective-reject is most high.
(3)
(1)When a=0.1 or 1, W=7 or 127>> 2a+1, so the lines of go-back-N with n=7 and go-back-N with n=127 overlap, selective-reject with w=7 and selective-reject with w=127 also overlap.
When a=10,则selective-reject with wand go-back-N both are分段函数
五、实验问题解答与体会
Through the first net experiment, I realize the principles of Data Link Control Protocols. Besides I write code to testify those principles, which
offers me deep insight of those two methods. As for me confusion, I don’t know the error correction part of CRC and how to modify the parity check to make more efficient. 教师评语:图不够清晰 成绩:A