You are on page 1of 2

GENERATION OF DATA TRAFFIC PROGRAM:clear all; close all; clc; use=input('enter the no of user:'); ts=input('enter the no of time slot:');

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 if test(i,j)>980 & test(i,j)<=990 data(i,j)=128000; else if test(i,j)>990 & test(i,j)<=998 data(i,j)=256000; else data(i,j)=512000; end end end end end end %TIME SLOT VS BANDWIDTH d=sum(data); figure(1); bar(d); xlabel('time slot'); ylabel('bandwidth(bps)');

%TIME SLOT 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 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('optinum buffer size:'); disp(buff);

You might also like