report packet voice transmission

5
Stochastic Systems Simulation of Packet Voice Transmission System Submitted By: Komal Ahmad

Upload: komal-ahmad

Post on 28-Mar-2015

206 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Report Packet Voice Transmission

Stochastic Systems

Simulation of Packet Voice Transmission System

Submitted By:Komal Ahmad

Page 2: Report Packet Voice Transmission

Packet Voice TransmissionBefore implementing this experiment, it is known that on the average 2/3 of all packets contain silence while rest of 1/3 packets carry active speech. With the help of this information we can implement this experiment in MATLAB.

In this experiment we need to implement the fraction of active voice packets which are discarded due to less transmission rate of the system. The whole experiment is repeated ‘n’ no. of times where n=10000 or more.First of all we need to generate active and silence voice packets with probability 1/3 and 2/3 respectively for 48 speakers or users by using random number generators. In MATLAB, for example, a number in the interval (0,1) can be produced with the simple statement x=rand(1,1). The number is chosen "at random" so that it is equally likely to be anywhere in the (0,1) interval. As a result, a number in the interval (0,1/3] will be observed with probability p = 1/3. The code below shows that packets are selected (active=1 and silence=0) on the basis of their probabilities for 48 speakers.

for j=1:n for i=1:Spkrs rand('state'); if rand(1,1)<=(1/3)

x(i,1)=1; else x(i,1)=0; end A(:,j)=A(:,j)+ x(i,1); end x=0;end

Repeating this code n no. of times will result in simulation of the previous experiment. At the end of each trial, the no of active packets is calculated and saved in an array ‘A’.In the next step, the probabilities ‘pk’ of active packets are calculated using relative frequencies ‘fk’ where no of active packets ‘k’ is 0 ≤k ≤ 48 and ‘Nk’ is the the no. of trials in which the number of active packets is k. Beside that we are also calculating no. of active packets produced for all n trials using pk.

for k=1:(Spkrs+1) for p=1:n if A(:,p)==(k-1) Nk(:,k)=Nk(:,k)+1; end end fk(:,k)=Nk(:,k)/n; pk(:,k)=fk(:,k); No_actpkt_prdcd=((k-1).*pk(:,k))+No_actpkt_prdcd;end

Finally, discarded fraction is calculated for different values of M. M is a system or transmission rate which discards active packets when A>M.

Page 3: Report Packet Voice Transmission

for M=0:30 for k=(M+1):Spkrs No_actpkt_Discarded= ((k-M).*pk(:,(k+1)))+ No_actpkt_Discarded; end Discard_Fraction(:,(M+1))= No_actpkt_Discarded/No_actpkt_prdcd; No_actpkt_Discarded=0;end

Ultimately discarded fraction is plotted against different values of M.

figure;M=0:30;m=[M];plot(m, Discard_Fraction,'-o')xlabel('Transmission rate: M packets/10 ms'); ylabel('Discard fraction');

0 5 10 15 20 25 300

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

Transmission rate: M packets/10 ms

Dis

card

fra

ctio

n

M=22, gives 1%discard fraction

The result of the plot tells that that the fraction of active packets discarded in the 48 speakers system is decreasing with increasing value of M. When M=0, discard fraction is maximum i.e. 1 and as M is increased its value approaches zero. By looking at the results, the optimum value of M that can compromise between voice quality and efficient use of resources especially bandwidth of the system is 22. Thus, voice transmission of all 48 speakers with only half the transmission speed gives significant cost savings.

Page 4: Report Packet Voice Transmission

Source Coden=10000; %% No. of trialsSpkrs=48; %% No. of Users/SpeakersA=zeros(1,n); %% No. of active pkts in each trial i.e (1 to n)Nk=zeros(1,(Spkrs+1)); %% No. of active pkts k in n trialsfk=zeros(1,(Spkrs+1)); %% Relative frequency of outcome kpk=zeros(1,(Spkrs+1)); %% Probability pk wh 0<k<48No_actpkt_prdcd=0;No_actpkt_Discarded=0;Discard_Fraction=zeros(1,31); for j=1:n for i=1:Spkrs rand('state'); if rand(1,1)<=(1/3) %% Active packet with p=1/3 x(i,1)=1; %% x=1 if active packet or x=0 if silence packet else x(i,1)=0; end A(:,j)=A(:,j)+ x(i,1); end x=0;endA; for k=1:(Spkrs+1) for p=1:n if A(:,p)==(k-1) Nk(:,k)=Nk(:,k)+1; end end fk(:,k)=Nk(:,k)/n; pk(:,k)=fk(:,k); No_actpkt_prdcd=((k-1).*pk(:,k))+No_actpkt_prdcd;endpk;No_actpkt_prdcd; for M=0:30 for k=(M+1):Spkrs No_actpkt_Discarded= ((k-M).*pk(:,(k+1)))+ No_actpkt_Discarded; end Discard_Fraction(:,(M+1))= No_actpkt_Discarded/No_actpkt_prdcd; No_actpkt_Discarded=0;endDiscard_Fraction; figure;M=0:30;m=[M];plot(m, Discard_Fraction,'-o')xlabel('Transmission rate: M packets/10 ms'); ylabel('Discard fraction');