Hi all,
Good day.
I am trying to understand this piece of code which i modified on top of a code that i acquired from github.io. I am trying to simulate Slotted Aloha protocol.
Node = 10; % number of nodes TOTAL_SLOT_NUMBER = 10000; % simulation time lambda = 1; % average one arrival per time slot q = poissrnd(lambda,Node,TOTAL_SLOT_NUMBER); % generate poisson dist for N and simulation time
for id=1:1:N
is_arrival = rand;
while is_arrival >=lambda*(exp(-lambda*q(index,t)))
buffered_number(id) = buffered_number(id) + 1;
generated = generated + 1;
is_arrival = rand*is_arrival;
end
end
It is imperative that i understand this piece of code so that i can be sure that poisson arrival of packets are being simulated correctly.
Your comments are welcomed. Let me know if there is a simpler way of doing it.
Thank you.
Regards, Muru