Generation
of Video traffic [Matlab]
clc;
clear
all;
use=input('Enter The
Number Of Users: ');
ts=input('Enter The
Number Of Time Slots: ');
on=0.35;
ton=zeros(use,ts);
n=ton;
for
i=1:use
for
j=1:ts
ton(i,:)=poissrnd((on*10),1,ts);
if(ton(i,j)>=3.5)
n(i,j)=1;
end
end
end
test=randint(use,ts,[1,1000]);
data=n;
for
i=1:use
for
j=1:ts
if
n(i,j)==1
if
test(i,j)>=1 && test(i,j)<=980
data(i,j)=64000;
else
data(i,j)=384000;
end
end
end
end
%Time
Slot Vs Bandwidth
d=sum(data);
figure(1);
bar(d);
xlabel('Time
Slot');
ylabel('Bandwidth
(bps)');
%Time
Slots Vs Error Rate
e=zeros(1,ts);
bm=1540000;
for
i=1:ts
if
d(i)>bm
e(i)=d(i)-bm;
end
end
figure(2);
bar(e);
xlabel('Time
Slot');
ylabel('Error Rate
(bps)');
avg=sum(e)/ts;
ber=avg/bm;
buff=0;
disp('Average Bit
Error Rate without Buffering: ');
disp(ber);
while
ber>1e-6
buff
=buff+10;
bm=bm+10;
for
i=1:ts
if
e(i)>0
e(i)=d(i)-bm;
end
end
s=sum(e);
ber=s/(ts*bm);
end
disp('Bit Error
Rate with Buffer: ');
disp(ber);
disp('Optimum
Buffer Size: ');
disp(buff);
No comments:
Post a Comment