📄 csma.m
字号:
function out=csma_depart(lambda,beta,q_r)
%***********************************************************************************
% lambda: total arrival rate of all stations
% beta: normalized duration of an idle slot
%***********************************************************************************
i=1;
g=i*q_r+lambda*beta;
while g<2, % i is the number of backlogged nodes
a=g*exp(-g);
b=exp(-g);
Departure_csma(i)=a/(beta+1-b);
Departure_csma_cd(i)=a/(beta + a + beta*(1 - b - a));
arrival_rate(i)=lambda;
i=i+1;
g=i*q_r+lambda*beta; % Expected number of attempted transmissions
% Note: impact of retransmission rate q_r and the number of backlogged node
% are captured in
end
figure;
plot([1:i-1],Departure_csma,'k-');
hold on;
plot([1:i-1],Departure_csma_cd,'k-o');
hold on;
plot([1:i-1],arrival_rate,'k--');
hold off;
set(gca,'FontSize',18);
%Title('Departure rate, in packets per unit time');
xlabel('N, the number of backlogged nodes');
legend('Departure rate of slotted CSMA','Departure rate of slotted CSMA/CD','Arrival rate',0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -