Generation of Voice traffic [Matlab]
clc;
clear
all;
use=input('Enter the
no of users: ');
ts=input('Enter the
no. 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
voice=64000*n;
% time
slot vs bw
d=sum(voice);
figure(1);
bar(d);
xlabel('Timeslot');
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('Timeslots');
ylabel('Error rate
(bps)');
avg=sum(e')/ts;
ber=avg/bm;
buff=0;
disp('Average bit
error rate without buffers:');
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('BER with
buffer:');
disp(ber);
disp('Optimum
buffer size');
disp(buff);
No comments:
Post a Comment