Professional Documents
Culture Documents
MS SYSTEMS ENGINEERING
Group (2):
Azmat Tanveer
Danish Nadeem
Faheem Ashraf
Fouwad Jamil Mir
Ghulam Mustafa
[ PREMPTIVE MARKOV
CHAIN ANALYSIS 1 ]
Lab Report
TABLE OF CONTENTS
Markov process ............................................................................................................................................. 3
Task 1 ............................................................................................................................................................ 3
Theoretical Probability .............................................................................................................................. 3
Matlab Results .......................................................................................................................................... 3
Matlab Code.............................................................................................................................................. 3
FlowChart .................................................................................................................................................. 4
Task2 ............................................................................................................................................................. 5
Theoretical probability .............................................................................................................................. 5
Matlab results ........................................................................................................................................... 5
Matlab code .............................................................................................................................................. 5
Flowchart .................................................................................................................................................. 7
Task 3,Task4 .................................................................................................................................................. 8
Theoretical probability .............................................................................................................................. 8
Matlab results ........................................................................................................................................... 8
Matlab code .............................................................................................................................................. 8
Flowchart ................................................................................................................................................ 10
MARKOV PROCESS
In probability theory and statistics, a Markov process, named after the Russian mathematician
Andrey Markov, is a time-varying random phenomenon for which a specific property (the Markov
property) holds. In a common description, a stochastic process with the Markov property, or
memorylessness, is one for which conditional on the present state of the system, its future and past
are independent.
TASK 1
Given a single server, determine the probability the server remains busy.
Assume the packet arrival time is distributed by Poisson Distribution and service time is
distributed by Exponential Distribution.
THEORETICAL PROBABILITY
( )
for =5 and =15 ,P(1)=0.25
( )
=5 and =15 ,P(0)=0.75
MATLAB RESULTS
p_1 =0.2605
p_0 =0.7395
MATLAB CODE
clear all
clc
lambda=5;
A=exprnd(lambda,1,5001);
P(1)=A(1);
for i=2:5001 P(i)=A(i)+P(i-1);%Poisson dist from exp
end
arrival=P;
%inter arrival time
service=exprnd(15,1,5000);
%exponential distribution
[l m]=size(arrival);
FLOWCHART
TASK2
If 4 number of servers are available, and packets arrive through a single channel, what is
the probability 4 number of servers remain busy simultaneously.
THEORETICAL PROBABILITY
theoretical probability for multiple servers with single stream of packets is found by formula
j / j!
Pj s
,
k
/ k!
j 0, 1, 2, , s .
k 0
=5 and =5
MATLAB RESULTS
p0 =0.3440
p1 = 0.3840
p2 =0.1940
p3 =0.0540
MATLAB CODE
clear all
close all
clc
lambda=5;
A=exprnd(lambda,1,500);
P(1)=A(1);
for i=2:50
P(i)=A(i)+P(i-1); %Poisson dist from exp
end
arrival=P;
service=exprnd(5,1,500);
[l m]=size(arrival);
%% initialization
%first element=arrival time
%2nd element=service time
%3rd element=busy
S1=[arrival(1) service(1) 1];
S2=zeros(1,3);
S3=zeros(1,3);
S4=zeros(1,3);
sum=1;
%number of server busy( sum of flags of servers)
n1=0;
n2=0;
FLOWCHART
MATLAB RESULTS
prem = 0
true =0
MATLAB CODE
clear all
close all
clc
lambda1=5;
a=exprnd(lambda1,1,10000);
P(1)=a(1);
for i=2:10000
P(i)=a(i)+P(i-1);%Poisson dist from exp
end
arrival1=P;
A=exprnd(5,1,10000);
lambda2=5;
a1=exprnd(lambda2,1,10000);
P2(1)=a1(1);
for i=2:10000
P2(i)=a1(i)+P2(i-1);%Poisson dist from exp
end
arrival2=P2;
B=exprnd(5,1,5000);
[l m]=size(A);
% A has higher priority than B
%%% 1st element arrival
%%% 2nd element service time
FLOWCHART
10
11