Suppose we want to solve the system of equations given below. The 6 global balance equations for states P00, P10, P20, P01, P11, and P02, respectively, are:
8P10 + 4P01 = 2P00 + 2P00
2P00 + 8P20 + 2P11 = 8P10 + 2P10 + 2P10
2P10 = 8P20
2P00 + 4P11 + 4P02 = 4P01 + 2P01 +2P01
2P10 + 2P01 = 2P11 + 4P11
2P01 = 4P02
As noted, one of the equations is redundant, so we can (arbitrarily) replace one of the above equations, say, the last equation, with:
P00 + P10 + P20 + P01 + P11 + P02 = 1
By rewriting, the resulting equations are:
- 4P00 + 8P10 + 0P20 + 4P01 + 0P11 + 0P02 = 0
+ 2P00 -12P10 + 8P20 + 0P01 + 2P11 + 0P02 = 0
+ 0P00 + 2P10 - 8P20 + 0P01 + 0P11 + 0P02 = 0
+ 2P00 + 0P10 + 0P20 - 8P01 + 4P11 + 4P02 = 0
+ 0P00 + 2P10 + 0P20 + 2P01 - 6P11 + 0P02 = 0
+ 1P00 + 1P10 + 1P20 + 1P01 + 1P11 + 1P02 = 1
These equations can then be written in matrix form AX=B, where
-4 8 0 4 0 0 P00 0
2 -12 8 0 2 0 P10 0
0 2 -8 0 0 0 P20 0
A = 2 0 0 -8 4 4 X = P01 B = 0
0 2 0 2 -6 0 P11 0
1 1 1 1 1 1 P02 1
Solving this problem (i.e., finding the unknown vector X, which are the steady state probabilities) using MATLAB is illustrated using the MATLAB session shown below.
indus{varki}44>>> /opt/matlab/bin/matlab
< M A T L A B (R) >
(c) Copyright 1984-94 The MathWorks, Inc.
All Rights Reserved
Version 4.2c
Dec 31 1994
MATLAB passcode expiration date of 01-nov-1997 is less than three months away.
Commands to get started: intro, demo, help help
Commands for more information: help, whatsnew, info, subscribe
>> A = [ -4 8 0 4 0 0
2 -12 8 0 2 0
0 2 -8 0 0 0
2 0 0 -8 4 4
0 2 0 2 -6 0
1 1 1 1 1 1 ]
A =
-4 8 0 4 0 0
2 -12 8 0 2 0
0 2 -8 0 0 0
2 0 0 -8 4 4
0 2 0 2 -6 0
1 1 1 1 1 1
>> B = [ 0
0
0
0
0
1 ]
B =
0
0
0
0
0
1
>> A\B
ans =
0.4324
0.1081
0.0270
0.2162
0.1081
0.1081
>> quit
362 flops.
indus{varki}45>>>
Note: like other Unix commands, you can redirect the input to the matlab command, i.e., you can create a file of the commands you wish to execute and avoid retyping the matrix contents every time. Thus, the following is equivalent.
...create your input file, say input
tschuss{varki}50>>> cat input
A = [ -4 8 0 4 0 0
2 -12 8 0 2 0
0 2 -8 0 0 0
2 0 0 -8 4 4
0 2 0 2 -6 0
1 1 1 1 1 1 ]
B = [ 0
0
0
0
0
1 ]
A\B
quit
indus{varki}50>>> /opt/matlab/bin/matlab < input
< M A T L A B (R) >
(c) Copyright 1984-97 The MathWorks, Inc.
All Rights Reserved
Version 5.1.0.421
May 25 1997
To get started, type one of these commands: helpwin, helpdesk, or demo.
For information on all of the MathWorks products, type tour.
>>
A =
-4 8 0 4 0 0
2 -12 8 0 2 0
0 2 -8 0 0 0
2 0 0 -8 4 4
0 2 0 2 -6 0
1 1 1 1 1 1
>>
B =
0
0
0
0
0
1
>>
ans =
0.4324
0.1081
0.0270
0.2162
0.1081
0.1081
>>
422 flops.
Return to the
CS 823
Home Page