Saturday 7 September 2013

Generation of ON-OFF traffic [Matlab]

Generation of ON-OFF traffic [Matlab]
 
 
clc;

clear all;

x=1:10;

t=1:100;

on=input('Enter the Average ON Time: ');

%Users Vs Average ON Time

ton=zeros(10,100);

for i=1:10

ton(i,:)=poissrnd((on*10),1,100);

end

a=ton';

b=mean(a);

c=b/1000;

figure(1);

bar(x,c,0.35);

xlabel('Users');

ylabel('Average ON Time');

%Timeslots Vs Number of Users

n=zeros(10,100);

for i=1:10

for j=1:100

if (ton(i,j)>=4.5)

n(i,j)=1;

end

end

end

d=sum(n);

figure(2);

bar(t,d);

xlabel('Time Slots');

ylabel('Number of Users');

%Time slots Vs Bandwidth

bw=64000*n;

for i=1:10

figure(3);

subplot(5,2,i);

bar(t,bw(i,:),0.2)

xlabel('Time Slots');

ylabel('BW Alloted');

end

No comments:

Post a Comment