**Wireless Channel Model with Markov Chains Using MATLAB**

Diana Alejandra Sánchez-Salas, José Luis Cuevas-Ruíz and Miguel González-Mendoza

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/3338

## **1. Introduction**

18 Will-be-set-by-IN-TECH

[8] D. Moad, Y. Hadjadj-Aoul, and F. Nait-Abdesselam. Predictive channel estimation for optimized resources allocation in dvb-s2 networks. In *Personal, Indoor and Mobile Radio Communications, 2009 IEEE 20th International Symposium on*, pages 2608 –2612, sept. 2009. [9] M. Smolnikar, T. Javornik, and M. Mohorcic. Target ber driven adaptive coding and modulation in hap based dvb-s2 system. In *Advanced Satellite Mobile Systems, 2008. ASMS*

[10] ETSI. Tr 126 975 v10.0.0 "digital cellular telecommunications system (phase 2+);universal mobile telecommunications system (umts);lte;performance characterization of the adaptive multi-rate (amr) speech codec" (3gpp tr 26.975 version 10.0.0 release 10), 04

[11] ETSI. En 302 307 v1.2.1 (2009-08)-digital video broadcasting (dvb);second generation framing structure, channel coding and modulation systems for broadcasting,interactive services, news gathering and other broadband satellite applications (dvb-s2), 2009. [12] D. Pradas, Lei Jiang, M.A. Vazquez Castro, P. Barsocchi, and F. Potorti. Satellite phy-layer selector design for video applications in tropical areas. In *Satellite and Space Communications, 2009. IWSSC 2009. International Workshop on*, pages 407 –411, sept. 2009.

*2008. 4th*, pages 262 –267, aug. 2008.

2011.

Emerging technology developed in last years is the result of the necessity of human to communicate in an effective and fast way from any point of the world. Since some type of loss is always present in a wireless link, new transmission and reception techniques for wireless communication systems require the study and characterization of the wireless channel.

Channel modeling is the characterization of the wireless channel; it describes how the characteristics of the sent signal can be affected or what the conditions of the environment are, i.e. frequency, obstacles in the path, etc. The channel model helps to evaluate the performance of the system and to compare different techniques to mitigate the perturbations so the best fitted solution can be implemented according to the presented problem.

The simplest model is the free space loss which considers no obstacles between transmitter and receptor. (Parsons, 2000) However this is an ideal model that does not exist in real scenario because there are other losses in the wireless channel. Another option to describe a channel is by using statistical models which are based on probability density functions (pdf). Although they do not describe the behavior of the sent signal in a complete way, they give a good approximation of the conditions of the channel in a certain moment. (Nakagami, 1960; Abouraddy & Elnoubi, 2000) The main statistical channels and their corresponding pdf are:

 Additive White Gaussian Noise, AWGN. This channel only includes the sum of the white noise that follows a normal or Gaussian density.

$$\exp(\mathbf{x}) = \frac{1}{\sigma\sqrt{2\pi}}\exp\left(-\frac{\left(\mathbf{x}\cdot\boldsymbol{\mu}\right)^{2}}{2\sigma^{2}}\right) \tag{1}$$

© 2012 Sánchez-Salas et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. © 2012 Sánchez-Salas licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Where:


$$\mathbf{p}(\mathbf{x}) = \frac{\mathbf{x}}{\sigma^2} \exp\left(-\frac{\left(\mathbf{x}^2 + \mathbf{A}^2\right)}{2\sigma^2}\right) \mathbf{I}\_0\left(\frac{\mathbf{A}\mathbf{x}}{\sigma^2}\right), \qquad \mathbf{A} \ge \mathbf{0} \tag{2}$$

Wireless Channel Model with Markov Chains Using MATLAB 237

Due to a wireless channel is a time variant channel, a better option to characterize a channel is Markov chains, which are a stochastic process with a limited number of states and whose transition between them is based on the probability of an event. States of Markov chains could be defined in agreement to channel conditions of an scenario, like it was done by E. Lutz who defined a two state channel model, one classified as good and the other one classified as bad depending on the conditions and therefore the attenuation level. Another important work is the one of B. Vucetic which characterizes the wireless channel of a certain area in Australia with a

Next sections explain in detail how to create a wireless channel model using Markov chains and its application in a communication system with a coder and modulator. To achieve this, it is also explained how to create a markovian chain using Matlab. The effects of this model are analyzed through BER curves. An analysis with a semimarkovian channel is explained in the last section and a comparative analysis is done between this model and that from Markov chains. Finally,

One type of stochastic process is Markov chains, named after Andrei Markov who studied the transitions between consonants and vowels in a poem at the beginning of the 20th century. In this process, a set is defined as {X(t), t = 0,1,2,...} whose number of elements is finite and denoted with real positive numbers. X(t) = i represents that the process is in state i at an instant of time t and take discrete values. It is said that there is a fixed probability pij that chain goes from a state i to a state j in the next time t. This process is represented in (5)

Markov property indicates that given the present state, the next state is conditionally independent of the past. This statement is illustrated in Figure 1 which shows that the

system can change from one condition to another or continues in the same state.

k+1 k+1 k k 1 1 k+1 k+1 k k P X t =x |X(t =x ,…,X t =x =P X t =x |X t =x (5)

four state Markov chain by combining four different types of statistical channels.

conclusions about both subjects are given. All the analysis is also done with Matlab.

**2. Markov chains** 

Where,

and it is known as the Markov property.

X(tk), Current sample. X(tk+1), Future sample. X(t1),...,X(tk-1), Past samples.

**2.1. Elements of Markov chains** 

Probability transition matrix **P**.

 Transition diagram. Steady-state vector **π**

xk, State of the sample in the moment k.

There are three important elements in Markov chains:

Where:


The relation between the power of the dominant signal and the power of the multipath is represented in (3).

$$\text{K}\left(\text{dB}\right) = 10\log\left(\frac{A^2}{2\sigma^2}\right) \tag{3}$$

Where:


As A value decrease, the function is closer to characterize a Rayleigh fading environment. Otherwise, if the A value increase, the function is used to model an AWGN channel.

 Rayleigh: represents fast fading and describes the multipath phenomenon with no LOS between transmitter and receptor which can be caused by a non stationary user.

$$\mathbf{p}(\mathbf{x}) = \frac{\mathbf{x}}{\sigma^2} \exp\left(-\frac{\mathbf{x}^2}{2\sigma^2}\right), \qquad \qquad \mathbf{x} \ge \mathbf{0} \tag{4}$$

Where:


Due to a wireless channel is a time variant channel, a better option to characterize a channel is Markov chains, which are a stochastic process with a limited number of states and whose transition between them is based on the probability of an event. States of Markov chains could be defined in agreement to channel conditions of an scenario, like it was done by E. Lutz who defined a two state channel model, one classified as good and the other one classified as bad depending on the conditions and therefore the attenuation level. Another important work is the one of B. Vucetic which characterizes the wireless channel of a certain area in Australia with a four state Markov chain by combining four different types of statistical channels.

Next sections explain in detail how to create a wireless channel model using Markov chains and its application in a communication system with a coder and modulator. To achieve this, it is also explained how to create a markovian chain using Matlab. The effects of this model are analyzed through BER curves. An analysis with a semimarkovian channel is explained in the last section and a comparative analysis is done between this model and that from Markov chains. Finally, conclusions about both subjects are given. All the analysis is also done with Matlab.

## **2. Markov chains**

One type of stochastic process is Markov chains, named after Andrei Markov who studied the transitions between consonants and vowels in a poem at the beginning of the 20th century. In this process, a set is defined as {X(t), t = 0,1,2,...} whose number of elements is finite and denoted with real positive numbers. X(t) = i represents that the process is in state i at an instant of time t and take discrete values. It is said that there is a fixed probability pij that chain goes from a state i to a state j in the next time t. This process is represented in (5) and it is known as the Markov property.

$$\mathbf{P}\left[\mathbf{X}\left(\mathbf{t}\_{\mathbf{k}+1}\right)=\mathbf{x}\_{\mathbf{k}+1}\mid\mathbf{X}\left(\mathbf{t}\_{\mathbf{k}}=\mathbf{x}\_{\mathbf{k'}},\ldots,\mathbf{X}\left(\mathbf{t}\_{1}\right)=\mathbf{x}\_{1}\right)=\mathbf{P}\left[\mathbf{X}\left(\mathbf{t}\_{\mathbf{k}+1}\right)=\mathbf{x}\_{\mathbf{k}+1}\mid\mathbf{X}\left(\mathbf{t}\_{\mathbf{k}}\right)=\mathbf{x}\_{\mathbf{k}}\right]\tag{5}$$

Where,

236 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

2 2

 Rice: represents a signal which is the result of the sum of the different multipath plus a dominant signal, known as the line of sight (LOS) between transmitter and receptor.

> 

σ2, Variance of the signal or mean power of the signal before the detection of the

The relation between the power of the dominant signal and the power of the multipath is

<sup>2</sup> K dB 10log <sup>2</sup>

σ2, Variance of the signal or mean power of the signal before the detection of the

As A value decrease, the function is closer to characterize a Rayleigh fading environment.

 Rayleigh: represents fast fading and describes the multipath phenomenon with no LOS between transmitter and receptor which can be caused by a non stationary user.

2

σ2, Variance of the signal or mean power of the signal before the detection of the

Otherwise, if the A value increase, the function is used to model an AWGN channel.

2 2 x x p x = exp - , x 0

σ 2σ

2

*A* 

 

(2)

(3)

(4)

2 22 0 <sup>x</sup> x +A Ax p x = exp - I , A 0

σ 2σ σ

Where:

Where:

Where:

Where:

μ, Mean.

σ2, Variance.

p(x), Probability density function.

p(x), Probability density function.

A, Amplitude of the dominant signal.

A, Amplitude of the dominant signal.

p(x), Probability density function.

envelope.

I0(), Zero order modified Bessel function of the first kind.

envelope.

represented in (3).

K, Rice factor.

envelope.

σ , Standard deviation.


Markov property indicates that given the present state, the next state is conditionally independent of the past. This statement is illustrated in Figure 1 which shows that the system can change from one condition to another or continues in the same state.

## **2.1. Elements of Markov chains**

There are three important elements in Markov chains:


The characteristics of each element will be given in next sections.

**Figure 1.** Markov Property

#### *2.1.1. Probability transition matrix*

The switch between states is established in the probability transition matrix **P**. Each element of it represents the probability that switches or remains in the state. These switches are called transitions. **P** is a square matrix whose order is the same to the number of states. Equation (6) shows the structure of a probability transition matrix.

$$\mathbf{P} = \begin{bmatrix} \mathbf{P}\_{00} & \mathbf{P}\_{01} & \mathbf{P}\_{02} & \cdots \\ \mathbf{P}\_{10} & \mathbf{P}\_{11} & \mathbf{P}\_{12} & \cdots \\ \cdot & \cdot & \cdot \\ \mathbf{P}\_{i0} & \mathbf{P}\_{i1} & \cdots \\ \cdot & \cdot & \cdot \end{bmatrix} \tag{6}$$

Wireless Channel Model with Markov Chains Using MATLAB 239

AA AB BA BB p p <sup>=</sup> p p 

**P**

p =1, i=1,2,3,… (8)

Another important characteristic of the probability transition matrix is that the sum of each

pij, Probability that current sample is in state i given the immediate precedent past

An advantage of markovian models is that they describe in an efficient way the characteristics of the system and therefore they can be solved by mathematic methods. In communication systems, Markov chains characterize in a better way the channel because it represents the combination of some phenomena that affects the signal during its wireless

A probability transition matrix can be also represented as a diagram called transition diagram. Each node ○ represents a state of the Markov chain indicated with a number inside; an arrow connects state i with state j if a transition exists and the transition probability pij is written on that connecting arrow, even if the transition is to the same state. (Nerlson, 2002) The transition diagram is also used to describe the model definitions; it is easy to see in this diagram the possible switches between states according to the probability. Next figures show the probability transition diagram for a two, three and four states

ij j

row must be equal to one.

i, Transition state i. j, Transition state j.

*2.1.2. Transition diagram* 

Markov chain with its transition matrix.

time was in state j.

transmission, having a better approach to a real channel.

**Figure 2.** Probability transition diagram for 2-state Markov chain

Where

Each element of **P** must satisfy the next condition.

$$\mathbf{p}\_{\parallel} \ge 0,\qquad\qquad\text{i.j=0,1,2,3...}\tag{7}$$

Where,

pij, Probability that current sample is in state i given the immediate precedent past time was in state j.

i, Transition state i.

j, Transition state j.

Condition of (7) is based on the argument that pij represents certain probability.

Another important characteristic of the probability transition matrix is that the sum of each row must be equal to one.

$$\sum\_{\mathbf{j}} \mathbf{p}\_{\mathbf{i}\mathbf{j}} = \mathbf{1}, \qquad \mathbf{i} = \mathbf{1}, \mathbf{2}, \mathbf{3}, \dots \tag{8}$$

Where

238 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

The switch between states is established in the probability transition matrix **P**. Each element of it represents the probability that switches or remains in the state. These switches are called transitions. **P** is a square matrix whose order is the same to the number of states.

> 00 01 02 10 11 12

ppp… ppp…

pij, Probability that current sample is in state i given the immediate precedent past

Condition of (7) is based on the argument that pij represents certain probability.

**P** (6)

ij p 0, i,j=0,1,2,3… (7)

i0 i1

= ... pp… . .…

Equation (6) shows the structure of a probability transition matrix.

Each element of **P** must satisfy the next condition.

time was in state j.

i, Transition state i. j, Transition state j.

The characteristics of each element will be given in next sections.

**Figure 1.** Markov Property

Where,

*2.1.1. Probability transition matrix* 

pij, Probability that current sample is in state i given the immediate precedent past time was in state j.

i, Transition state i.

j, Transition state j.

An advantage of markovian models is that they describe in an efficient way the characteristics of the system and therefore they can be solved by mathematic methods. In communication systems, Markov chains characterize in a better way the channel because it represents the combination of some phenomena that affects the signal during its wireless transmission, having a better approach to a real channel.

#### *2.1.2. Transition diagram*

A probability transition matrix can be also represented as a diagram called transition diagram. Each node ○ represents a state of the Markov chain indicated with a number inside; an arrow connects state i with state j if a transition exists and the transition probability pij is written on that connecting arrow, even if the transition is to the same state. (Nerlson, 2002) The transition diagram is also used to describe the model definitions; it is easy to see in this diagram the possible switches between states according to the probability. Next figures show the probability transition diagram for a two, three and four states Markov chain with its transition matrix.

**Figure 2.** Probability transition diagram for 2-state Markov chain

Wireless Channel Model with Markov Chains Using MATLAB 241

<sup>π</sup> =1 (10)

**2states <sup>P</sup>** (11)

1 2 <sup>=</sup> π π **2states <sup>π</sup>** (12)

One property of the **π** vector is that the sum of its elements must be equal to one as it is

i i

In this section you will find the steps and the code to create a Markov chain using Matlab for two and three states. This code will be useful to create a wireless channel model that, within

The simpler case in Markov chains is the one with two states. The first step for the creation of a chain is to establish a transition matrix that indicates the switch between states. The transition matrix and the steady state vector for a two state model is shown in (11) and (12).

The input data for the Matlab code will be the probability transition matrix and the size of the output vector. Since this is a stochastic event, the first sample and the switch between stated will be obtained in a random way but always following the characteristics of **P**. It is also possible to have an initial distribution for the first sample. The precise steps to create

a) Generate a random integer number between 1 and 2 (because of the two state

c) If previous sample was 1 and the generated number in step b) is equal or less to p12,

d) If previous sample was 2 and the generated number in step b) is equal or less to p21,

e) Repeat steps b) to d) until complete the number of samples required. The generated

11 12 21 22 p p <sup>=</sup> p p

a wireless communications system, will be simulated using Matlab in next section.

Where,

shown in (10).

Where,

**P**, Probability transition matrix. **π**, Steady state probability vector **1**, Column vector of ones: **1T** = (1,1,…)

πi, Steady state probability for state i.

**3.1. Two-state Markov chains** 

the Matlab code are listed below.

b) Generate a random natural number between 0 and 1.

next sample will switch to 1, otherwise will be 2.

series is the resultant Markov chain.

next sample of the chain is going to be 2; otherwise will be 1.

markovian chain).

**3. Creation of a Markov chains in Matlab** 

**Figure 3.** Probability transition diagram for 3-state Markov chain

**Figure 4.** Probability transition diagram for 4-state Markov chain

#### *2.1.3. Steady-state vector*

Another important element in Markov chains is the steady-state vector **π**, which represents the total appearing percentage of a state in a Markov chain. This vector can be computed by raising **P** to a large power. This is shown in (9).

$$\mathbf{P}^n \to 1\mathbf{n} \tag{9}$$

Where,

240 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

**Figure 3.** Probability transition diagram for 3-state Markov chain

**Figure 4.** Probability transition diagram for 4-state Markov chain

raising **P** to a large power. This is shown in (9).

Another important element in Markov chains is the steady-state vector **π**, which represents the total appearing percentage of a state in a Markov chain. This vector can be computed by

*2.1.3. Steady-state vector* 

AA AB AC BA BB BC CA CB CC

AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD

p ppp

p ppp

p ppp <sup>=</sup> p ppp

**P**

<sup>n</sup> **P** 1**π** (9)

p pp =p p p p pp 

**P**


One property of the **π** vector is that the sum of its elements must be equal to one as it is shown in (10).

$$\sum\_{\mathbf{i}} \pi\_{\mathbf{i}} = 1 \tag{10}$$

Where,

πi, Steady state probability for state i.

## **3. Creation of a Markov chains in Matlab**

In this section you will find the steps and the code to create a Markov chain using Matlab for two and three states. This code will be useful to create a wireless channel model that, within a wireless communications system, will be simulated using Matlab in next section.

## **3.1. Two-state Markov chains**

The simpler case in Markov chains is the one with two states. The first step for the creation of a chain is to establish a transition matrix that indicates the switch between states. The transition matrix and the steady state vector for a two state model is shown in (11) and (12).

$$\mathbf{P\_{2\text{states}}} = \begin{bmatrix} \mathbf{P\_{11}} & \mathbf{P\_{12}} \\ \mathbf{P\_{21}} & \mathbf{P\_{22}} \end{bmatrix} \tag{11}$$

$$\mathbf{m\_{2states}} = \begin{bmatrix} \pi\_1 & \pi\_2 \end{bmatrix} \tag{12}$$

The input data for the Matlab code will be the probability transition matrix and the size of the output vector. Since this is a stochastic event, the first sample and the switch between stated will be obtained in a random way but always following the characteristics of **P**. It is also possible to have an initial distribution for the first sample. The precise steps to create the Matlab code are listed below.


The Matlab code for these steps is shown next.

*function [channel] = markovChain2States(P,lengthChain) channel = zeros(1,lengthChain); % 2-state Markov chain (output vector) channel(1) = randint(1,1,[1 2]); % Step a) for i = 2:lengthChain event = randint(1,1,[1 100])/100; % Step b) if channel(1,i-1) == 1 % Step c) if event <= P(1,2) % Switch to state 2 channel(1,i) = 2; else % No switch channel(1,i) = 1; end elseif channel(1,i-1) == 2 % Step d) if event <= P(2,1) % Switch to state 1 channel(1,i) = 1; else % No switch channel(1,i) = 2; end; end; end* 

The output vector will determine the moment when the sent signal will be affected by certain probabilistic channel established previously.

### **3.2. Three-state Markov chains**

Another common case in Markov chains is the three-state case. The proceeding to create this type of chain in Matlab is similar to the two-state model. The input is the 3 x 3 size probability transition matrix, like the one shown in (13) and the output vector will be also the vector containing the Markov chain with the characteristics set by **P**.

$$\mathbf{P\_{3cham}} = \begin{bmatrix} \mathbf{P\_{11}} & \mathbf{P\_{12}} & \mathbf{P\_{13}} \\ \mathbf{P\_{21}} & \mathbf{P\_{22}} & \mathbf{P\_{23}} \\ \mathbf{P\_{31}} & \mathbf{P\_{32}} & \mathbf{P\_{33}} \end{bmatrix} \tag{13}$$

Wireless Channel Model with Markov Chains Using MATLAB 243

11 12 11 13 12 11 11 12 21 22 21 23 22 21 21 22 31 32 31 33 32 31 31 32

Once **P'3chan** was computed, the proceeding to create the resulting Markov chain is the same

a) Generate a random integer number between 1 and 3 (because now it is a three-state model). This will be the first sample of the chain, although an initial distribution can be

c) If previous sample was 1 and the generated number in step b) is less than p11, the next sample will be 1; if it is greater than p12', next sample will be 3, otherwise will be 2. d) If preceding sample was 2 and the generated number in step b) is less than p21, the next sample will be 1; if it is greater than p22', next sample will be 3; if not, it will be 2. e) If previous sample was 3 and the generated number in step b) is less than p31, next sample will be 1; if it is greater than p32', next sample will be 3, otherwise will be 2.

f) Repeat steps b) – e) until complete the required size of the Markov chain.

*channel = zeros(1,lengthChain); % 3-state Markov chain (output vector).* 

as the two-state one. The steps are listed next.

b) Generate a random natural number between 0 and 1.

The Matlab code for the previous steps is presented next.

*function [channel] = markovChain3States(P,lengthChain)* 

 *elseif event > P1(1,2) % Switch to state 3* 

 *channel(1,i) = 2; % Switch to state 2* 

 *if event < P1(2,1) % Switch to state 1* 

 *elseif event > P1(2,2) % Switch to state 3* 

 *else % No switch* 

 *elseif channel(1,i-1) == 2 % Step d)* 

*channel(1) = randint(1,1,[1 3]); % Step a)* 

*P1 = cumsum(P,2); % P'3chan* 

 *event = randint(1,1,[1 100])/100; % Step b) if channel(1,i-1) == 1 % Step c) if event < P1(1,1) % No switch* 

*for i = 2:lengthChain* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 3;* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 3;* 

 *channel(1,i) = 2;* 

 *else* 

 *end* 

 *end* 

established for this case.

p p +p p +p +p p p ' 1 = p p +p p +p +p = p p ' 1 p p +p p +p +p p p ' 1 

**3chan P'** (15)

The **π** vector for a three-state Markov chain is shown in (14).

$$\mathbf{m\_{2chan}} = \begin{bmatrix} \pi\_1 & \pi\_2 & \pi\_3 \end{bmatrix} \tag{14}$$

The first step now will be to modify the probability transition matrix by computing the cumulative sum for each row because this will determine the transition between states. This step is show in (15).

$$\mathbf{P'\_{3\text{char}}} = \begin{bmatrix} \mathbf{P\_{11}} & \mathbf{P\_{12}} \, ^\ast \mathbf{P\_{11}} & \mathbf{P\_{13}} \, ^\ast \mathbf{P\_{12}} \, ^\ast \mathbf{P\_{11}} \\\\ \mathbf{P\_{21}} & \mathbf{P\_{22}} \, ^\ast \mathbf{P\_{21}} & \mathbf{P\_{23}} \, ^\ast \mathbf{P\_{22}} \, ^\ast \mathbf{P\_{22}} \\\\ \mathbf{P\_{31}} & \mathbf{P\_{32}} \, ^\ast \mathbf{P\_{31}} & \mathbf{P\_{33}} \, ^\ast \mathbf{P\_{32}} + \mathbf{P\_{31}} \end{bmatrix} = \begin{bmatrix} \mathbf{P\_{11}} & \mathbf{P\_{12}} \, ^\ast \mathbf{1} \\\\ \mathbf{P\_{21}} & \mathbf{P\_{22}} \, ^\ast \mathbf{1} \\\\ \mathbf{P\_{31}} & \mathbf{P\_{32}} \, ^\ast \mathbf{1} \end{bmatrix} \tag{15}$$

Once **P'3chan** was computed, the proceeding to create the resulting Markov chain is the same as the two-state one. The steps are listed next.


242 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

*channel = zeros(1,lengthChain); % 2-state Markov chain (output vector)* 

The output vector will determine the moment when the sent signal will be affected by

Another common case in Markov chains is the three-state case. The proceeding to create this type of chain in Matlab is similar to the two-state model. The input is the 3 x 3 size probability transition matrix, like the one shown in (13) and the output vector will be also

> 11 12 13 21 22 23 31 32 33

**3chan P** (13)

<sup>123</sup> = πππ **2chan π** (14)

ppp =p p p ppp 

The first step now will be to modify the probability transition matrix by computing the cumulative sum for each row because this will determine the transition between states. This

the vector containing the Markov chain with the characteristics set by **P**.

The **π** vector for a three-state Markov chain is shown in (14).

The Matlab code for these steps is shown next.

*for i = 2:lengthChain* 

 *channel(1,i) = 2;* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 2; end; end; end* 

step is show in (15).

**3.2. Three-state Markov chains** 

 *end* 

*function [channel] = markovChain2States(P,lengthChain)* 

*channel(1) = randint(1,1,[1 2]); % Step a)* 

 *event = randint(1,1,[1 100])/100; % Step b) if channel(1,i-1) == 1 % Step c)* 

 *else % No switch* 

 *elseif channel(1,i-1) == 2 % Step d)* 

 *else % No switch* 

certain probabilistic channel established previously.

 *if event <= P(1,2) % Switch to state 2* 

 *if event <= P(2,1) % Switch to state 1* 


The Matlab code for the previous steps is presented next.

#### *function [channel] = markovChain3States(P,lengthChain)*



The methodology explained above can be used as a base to create an n-state Markov chain.

Wireless Channel Model with Markov Chains Using MATLAB 245

system and the markovian channel of figures below. Next sections explain with details the

As it was said before, this is the simplest model in Markov chains. According to the

Channel 1: Rice K = 14 dB. This channel represents the better conditions because of its

Channel 2: Rayleigh. This channel corresponds to a mobile user and multipath

Now, three examples about two-state markovian channel model are proposed next.

proposed scenario, the two statistical channels used for this case are:

**Figure 5.** Block diagram for a communication system with markovian channel

examples and its results.

strong LOS.

**4.1. Two-state Markov channel model** 

generated from the movement.

**Figure 6.** Block diagram of the markovian channel

To proof the created Markov chain follows a specific probability transition matrix is by counting the number of each one of possible transitions and dividing them by the sum of the total transitions for the corresponding state. To verify that the chain follows also the steadystate vector it is necessary to count the number of times each state appeared in the chain and divide each count by the total number of samples (size of the output vector).

Two and three-state Markov chains Matlab program described above represents the wireless transmission channel that will be implemented in a communication system. This will be done by simulating a message is being sent through it, all with Matlab.

## **4. Implementation of a Markov chains in Matlab**

Another alternative to characterize a wireless channel is using Markov chains as it was said before. This model is a better option than statistic channels (AWGN, Rice, Rayleigh) because the former represent a statistical channel combination of the latter. To show the application of Markov chains in this area the next scenario is proposed.

"A wireless channel model must be created in such manner it characterizes the principal causes of attenuation, for instance: the obstacles between the transmitter and receiver, a mobile user or the influence of the line of sight (LOS)."

The statistic channels for the scenario area are defined as Rayleigh and Rice. The former characterize a mobile user and the latter the LOS between transmitter and receiver.

To simulate this scenario in Matlab, a communication system with a QPSK and rate 2/3 convolutional code is proposed. The block diagram of this system and the channel model are illustrated in Figure 3 and 4. Markov chains will be used as a base to create a wireless channel model and will represent the multiplicative fading, which is right after the transmitter, and will be switching between the possible channels according to the probability transition matrix, as it is shown in Figure 4. From now, this model will be called as a "markovian channel".

To have a better understanding of this markovian model, several examples with different probability transition with its steady-state vector, calculated using (9), are proposed. The codes for the creation of a two and three state Markov chains are used to produce results. Interpretations are based on BER curves obtained by implementing the communication system and the markovian channel of figures below. Next sections explain with details the examples and its results.

#### **4.1. Two-state Markov channel model**

244 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

divide each count by the total number of samples (size of the output vector).

done by simulating a message is being sent through it, all with Matlab.

**4. Implementation of a Markov chains in Matlab** 

of Markov chains in this area the next scenario is proposed.

mobile user or the influence of the line of sight (LOS)."

as a "markovian channel".

The methodology explained above can be used as a base to create an n-state Markov chain.

To proof the created Markov chain follows a specific probability transition matrix is by counting the number of each one of possible transitions and dividing them by the sum of the total transitions for the corresponding state. To verify that the chain follows also the steadystate vector it is necessary to count the number of times each state appeared in the chain and

Two and three-state Markov chains Matlab program described above represents the wireless transmission channel that will be implemented in a communication system. This will be

Another alternative to characterize a wireless channel is using Markov chains as it was said before. This model is a better option than statistic channels (AWGN, Rice, Rayleigh) because the former represent a statistical channel combination of the latter. To show the application

"A wireless channel model must be created in such manner it characterizes the principal causes of attenuation, for instance: the obstacles between the transmitter and receiver, a

The statistic channels for the scenario area are defined as Rayleigh and Rice. The former

To simulate this scenario in Matlab, a communication system with a QPSK and rate 2/3 convolutional code is proposed. The block diagram of this system and the channel model are illustrated in Figure 3 and 4. Markov chains will be used as a base to create a wireless channel model and will represent the multiplicative fading, which is right after the transmitter, and will be switching between the possible channels according to the probability transition matrix, as it is shown in Figure 4. From now, this model will be called

To have a better understanding of this markovian model, several examples with different probability transition with its steady-state vector, calculated using (9), are proposed. The codes for the creation of a two and three state Markov chains are used to produce results. Interpretations are based on BER curves obtained by implementing the communication

characterize a mobile user and the latter the LOS between transmitter and receiver.

 *elseif channel(1,i-1) == 3 % Step e)* 

 *elseif event > P1(3,2) % No switch* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 3;* 

 *channel(1,i) = 2; end; end; end* 

 *if event < P1(3,1) % Switch to state 1* 

 *else % Switch to state 2* 

As it was said before, this is the simplest model in Markov chains. According to the proposed scenario, the two statistical channels used for this case are:


Now, three examples about two-state markovian channel model are proposed next.

**Figure 5.** Block diagram for a communication system with markovian channel

**Figure 6.** Block diagram of the markovian channel

*Example 1.* The next two Markov channels are proposed.

$$\mathbf{P\_{2cham1}} = \begin{bmatrix} 1 & 0 \\ 1 & 0 \end{bmatrix} \tag{16}$$

Wireless Channel Model with Markov Chains Using MATLAB 247

Channel 1: 99.9 % Channel 2: 0.01 %

Channel 1: 0 % Channel 2: 100 %

To verify the results of the markovian channel, BER curves of systems using exclusively each statistical channel were obtained too. It can be appreciated in Figure 5 that the resulting BER curve for **P2chan1** is exactly the same as the one resulting from the simulation of the Rice K = 14 dB statistical channel. Likewise, BER curve generated from **P2chan2** is exactly the same

To proof the Markov channel follows the characteristics of (16) and (17), a counting of the transitions and the number of times both channels appeared is realized from the created Markov chain. The size of the simulated sent message was 100,000 bits, so the results of the count are given as percentages, which is equivalent to the probabilities of the transition

> Channel 1 to 2: 0 % Channel 2 to 2: 0 %

> Channel 1 to 2: 0 % Channel 2 to 2: 100 %

As it can be observed, obtained results from counting are equal to the probability transition matrix of (16). This means that 100% of chances there was a transition from channel 1 to 1 and from channel 2 to 1. Channel 1 appeared 99.99% which says that at the first sample of the chain was channel 2 but immediately after switched to channel 1, that is why the third column of Table 1 is not the same to the steady-state vector of (18) but it

For the case of **P2chan2**, it is appreciated that channel 1 never appeared in the Markov chain, thus 100% of chances remained in channel 1, so data from the third column of Table 2 has

*Example 2.* In contrast to Example 1, these two probability transition matrixes and its steady-

0.2 0.8 <sup>=</sup> 0.2 0.8

0.8 0.2 <sup>=</sup> 0.8 0.2

**2chan3 <sup>P</sup>** (20)

= 0.2 0.8 **2chan3 π** (21)

**2chan4 <sup>P</sup>** (22)

= 0.8 0.2 **2chan4 π** (23)

to the simulation where only Rayleigh statistical channel is implemented.

matrixes. Those results are given in Table 1 and 2.

the same characteristics of the steady state vector of (19).

Channel 1 to 1: 100 % Channel 2 to 1: 100 %

Channel 1 to 1: 0 % Channel 2 to 1: 0 %

is very close to it.

state vectors are proposed.

**Table 1.** Counting of events for **P2chan1**

**Table 2.** Counting of events for **P2chan2**

$$\mathbf{P\_{2chan2}} = \begin{bmatrix} 0 & 1 \\ 0 & 1 \end{bmatrix} \tag{17}$$

And their steady-state vectors are shown in (18) and (19).

$$\mathbf{m\_{2cham1}} = \begin{bmatrix} 1 & 0 \end{bmatrix} \tag{18}$$

$$\mathbf{m}\_{\text{2cham2}} = \begin{bmatrix} 0 & 1 \end{bmatrix} \tag{19}$$

Channel **P2chan1** sets that channel 1 (Rice K = 14 dB) appears all the time, in other words, there is a strong LOS between transmitter and receiver, which can be referred as a rural environment where there is no tall buildings that blocks that line of sight. Conversely, channel **P2chan2** establish that channel 2 (Rayleigh) will appear all the time, this channels can be seen as an urban environment where there is a lot of obstacles between transmitter and receiver that will cause the multipath or also it can represents an user who is moving from one point to another one. These two channels were simulated with the communication system of Figure 3 in Matlab and the BER curves obtained are shown in Figure 5.

**Figure 7.** Two state Markov cannel for Example 1

To verify the results of the markovian channel, BER curves of systems using exclusively each statistical channel were obtained too. It can be appreciated in Figure 5 that the resulting BER curve for **P2chan1** is exactly the same as the one resulting from the simulation of the Rice K = 14 dB statistical channel. Likewise, BER curve generated from **P2chan2** is exactly the same to the simulation where only Rayleigh statistical channel is implemented.

To proof the Markov channel follows the characteristics of (16) and (17), a counting of the transitions and the number of times both channels appeared is realized from the created Markov chain. The size of the simulated sent message was 100,000 bits, so the results of the count are given as percentages, which is equivalent to the probabilities of the transition matrixes. Those results are given in Table 1 and 2.


**Table 1.** Counting of events for **P2chan1**

246 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

1 0 <sup>=</sup> 1 0 

0 1 <sup>=</sup> 0 1 

Channel **P2chan1** sets that channel 1 (Rice K = 14 dB) appears all the time, in other words, there is a strong LOS between transmitter and receiver, which can be referred as a rural environment where there is no tall buildings that blocks that line of sight. Conversely, channel **P2chan2** establish that channel 2 (Rayleigh) will appear all the time, this channels can be seen as an urban environment where there is a lot of obstacles between transmitter and receiver that will cause the multipath or also it can represents an user who is moving from one point to another one. These two channels were simulated with the communication

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

system of Figure 3 in Matlab and the BER curves obtained are shown in Figure 5.

**2chan1 <sup>P</sup>** (16)

**2chan2 <sup>P</sup>** (17)

=1 0 **2chan1 π** (18)

=0 1 **2chan2 π** (19)

*Example 1.* The next two Markov channels are proposed.

And their steady-state vectors are shown in (18) and (19).

**Figure 7.** Two state Markov cannel for Example 1

Only Rice (Chan 1) Only Rayleigh (Chan 2)

P2chan1 P2chan2

10-5

10-4

10-3

BER

10-2

10-1

100


**Table 2.** Counting of events for **P2chan2**

As it can be observed, obtained results from counting are equal to the probability transition matrix of (16). This means that 100% of chances there was a transition from channel 1 to 1 and from channel 2 to 1. Channel 1 appeared 99.99% which says that at the first sample of the chain was channel 2 but immediately after switched to channel 1, that is why the third column of Table 1 is not the same to the steady-state vector of (18) but it is very close to it.

For the case of **P2chan2**, it is appreciated that channel 1 never appeared in the Markov chain, thus 100% of chances remained in channel 1, so data from the third column of Table 2 has the same characteristics of the steady state vector of (19).

*Example 2.* In contrast to Example 1, these two probability transition matrixes and its steadystate vectors are proposed.

$$\mathbf{P\_{2cham3}} = \begin{bmatrix} 0.2 & 0.8\\ 0.2 & 0.8 \end{bmatrix} \tag{20}$$

$$\mathbf{m\_{2cham3}} = \begin{bmatrix} 0.2 & 0.8 \end{bmatrix} \tag{21}$$

$$\mathbf{P\_{2cham4}} = \begin{bmatrix} 0.8 & 0.2 \\ 0.8 & 0.2 \end{bmatrix} \tag{22}$$

$$\mathbf{m\_{2cham4}} = \begin{bmatrix} 0.8 & 0.2 \end{bmatrix} \tag{23}$$

The interpretation for the channel of **P2chan3** is that 80% of chances, Rayleigh channel will be present in the Markov chain meaning that the user is moving (walking, running) and LOS conditions are poor. For channel **P2chan4** probabilities are opposite than the other channel, in other words, there is a greater probability of having LOS than multipath, like in a rural area. Resulting BER curves for both channels are shown in Figure 8, where it shows that BER curves from markovian channels of (20) and (22) are very close to that curves resulting from simulating only the correspondent statistical channel but they are not the same, proving the combination of the channels according to the probability transition matrixes.

Wireless Channel Model with Markov Chains Using MATLAB 249

Channel 1: 75.29 % Channel 2: 24.71 %

**Figure 9.** Two State Markov Channel for Example 3

P2chan5

Only Rice (Chan 1) Only Rayleigh (Chan 2)

times a state appeared is presented next.

**4.2. Three-state Markov channel model** 

 Channel 1: Rice K = 14 dB, very strong LOS. Channel 2: Rayleigh, multipath and moving user.

Channel 3: Rice K = 7 dB, not a strong LOS like channel 1.

Channel 1 to 1: 70.15 % Channel 2 to 1: 90.93 %

10-5

10-4

10-3

BER

10-2

10-1

100

not identically to it.

**Table 3.** Counting of events for **P2chan5**

To verify the channel model was well implemented the counting of switches and how many

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

The count of transitions between states and the times each state (or probabilistic channel) appeared in the Markov chains indicate probability transition matrix shown in (25) was followed. This can be observed also in Figure 9 where the BER curve for the channel model presents an inclination to the curve obtained when only Rice channel is simulated but it is

A two-state channel model is not enough to characterize a wireless channel. To create a better model it is necessary to add more statistical channel. According to the proposed

scenario at the beginning of the section, the three statistical channels proposed are:

Channel 1 to 2: 29.85 % Channel 2 to 2: 9.07 %

**Figure 8.** Two State Markov Channel for Example 2

*Example 3.* A probability transition matrix shown in (24) with its steady-state vector in (25) is presented as a new wireless channel model. In this channel model the user has LOS the most part of the time but in some instants experiments multipath. This seems a semi urban environment because it can exists some building that cause multipath but they are not that tall to block the line of sight. BER curve for this model is shown in Figure 9.

$$\mathbf{P\_{2chan5}} = \begin{bmatrix} 0.7 & 0.3 \\ 0.9 & 0.1 \end{bmatrix} \tag{24}$$

$$\mathbf{m\_{2chans5}} = \begin{bmatrix} 0.75 & 0.25 \end{bmatrix} \tag{25}$$

**Figure 9.** Two State Markov Channel for Example 3

To verify the channel model was well implemented the counting of switches and how many times a state appeared is presented next.


**Table 3.** Counting of events for **P2chan5**

248 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

transition matrixes.

10-5

10-4

10-3

BER

10-2

10-1

100

**Figure 8.** Two State Markov Channel for Example 2

P2chan3 P2chan4

Only Rice (Chan 1) Only Rayleigh (Chan 2)

The interpretation for the channel of **P2chan3** is that 80% of chances, Rayleigh channel will be present in the Markov chain meaning that the user is moving (walking, running) and LOS conditions are poor. For channel **P2chan4** probabilities are opposite than the other channel, in other words, there is a greater probability of having LOS than multipath, like in a rural area. Resulting BER curves for both channels are shown in Figure 8, where it shows that BER curves from markovian channels of (20) and (22) are very close to that curves resulting from simulating only the correspondent statistical channel but they are not the same, proving the combination of the channels according to the probability

*Example 3.* A probability transition matrix shown in (24) with its steady-state vector in (25) is presented as a new wireless channel model. In this channel model the user has LOS the most part of the time but in some instants experiments multipath. This seems a semi urban environment because it can exists some building that cause multipath but they are not that

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

0.7 0.3 <sup>=</sup> 0.9 0.1

**2chan5 <sup>P</sup>** (24)

= 0.75 0.25 **2chan5 π** (25)

tall to block the line of sight. BER curve for this model is shown in Figure 9.

The count of transitions between states and the times each state (or probabilistic channel) appeared in the Markov chains indicate probability transition matrix shown in (25) was followed. This can be observed also in Figure 9 where the BER curve for the channel model presents an inclination to the curve obtained when only Rice channel is simulated but it is not identically to it.

### **4.2. Three-state Markov channel model**

A two-state channel model is not enough to characterize a wireless channel. To create a better model it is necessary to add more statistical channel. According to the proposed scenario at the beginning of the section, the three statistical channels proposed are:


As it was done for the two-state channel model, different probability transition matrixes with are analyzed through BER curves to proof the correct implementation of the channel in a communication system of Fig. 5.

*Example 4.* Three markovian channels are proposed.

$$\mathbf{P\_{3cham1}} = \begin{bmatrix} 1 & 0 & 0 \\ 1 & 0 & 0 \\ 1 & 0 & 0 \end{bmatrix} \tag{26}$$

Wireless Channel Model with Markov Chains Using MATLAB 251

**Figure 10.** Three State Markov Channel for Example 4

P3chan1 P3chan2 P3chan3

Only Rice K=14 dB (Chan 1) Only Rayleigh (Chan 2) Only Rice K=7 dB (Chan 3)

10-4

10-3

10-2

BER

10-1

100

indicated in each steady-state vector.

0.8 0.1 0.1 = 0.8 0.1 0.1 0.8 0.1 0.1 

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

0.1 0.8 0.1 = 0.1 0.8 0.1 0.1 0.8 0.1 

0.1 0.1 0.8 = 0.1 0.1 0.8 0.1 0.1 0.8 

Results are shown in Figure 11 where each BER curve are very close to the curve resulted from the simulation of only statistical channels (according to each case), confirming what is

**3chan4 P** (32)

= 0.8 0.1 0.1 **3chan1 π** (33)

**3chan5 P** (34)

= 0.1 0.8 0.1 **3chan1 π** (35)

**3chan6 P** (36)

= 0.1 0.1 0.8 **3chan1 π** (37)

$$\mathbf{P}\_{\mathbf{3echan2}} = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 0 \end{bmatrix} \tag{27}$$

$$\mathbf{P\_{3cham3}} = \begin{bmatrix} 0 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{bmatrix} \tag{28}$$

Its steady-state vectors are shown next.

$$\mathbf{m}\_{\text{3cham1}} = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix} \tag{29}$$

$$\mathbf{m\_{3cham2}} = \begin{bmatrix} 0 & 1 & 0 \end{bmatrix} \tag{30}$$

$$\mathbf{m}\_{\mathbf{3cham3}} = \begin{bmatrix} 0 & 0 & 1 \end{bmatrix} \tag{31}$$

The goal of these models is to verify the correct implementation of the markovian channels into a communication system. Each one of them establishes that they must stay always in the same channel. Results are compared with BER curves when only statistical channels are simulated. Figure 10 shows each BER curve obtained from the Markov chains models of (26) – (28) are almost the same to the ones obtained when only the corresponding statistical channel is simulated.

Markovian channel of (26) can be compared to a rural area where LOS is very probable because there are no tall buildings. Channel model of (27) can be interpreted as an urban zone because the multipath and users are constantly moving. Markov channel of (28) indicates LOS but not as strong as channel 1, so it can be seen as a semi-urban area because there are not a lot of tall buildings to block the transmission.

*Example 5.* Another three markovian channel models are proposed where it is indicated that each channel must be present in the Markov chain 80% of times. Probability transition matrixes and steady-state vectors are shown in (32)-(37).

**Figure 10.** Three State Markov Channel for Example 4

a communication system of Fig. 5.

Its steady-state vectors are shown next.

channel is simulated.

*Example 4.* Three markovian channels are proposed.

As it was done for the two-state channel model, different probability transition matrixes with are analyzed through BER curves to proof the correct implementation of the channel in

> 100 =1 0 0 100

> 010 =0 1 0 010

> 001 =0 0 1 001

The goal of these models is to verify the correct implementation of the markovian channels into a communication system. Each one of them establishes that they must stay always in the same channel. Results are compared with BER curves when only statistical channels are simulated. Figure 10 shows each BER curve obtained from the Markov chains models of (26) – (28) are almost the same to the ones obtained when only the corresponding statistical

Markovian channel of (26) can be compared to a rural area where LOS is very probable because there are no tall buildings. Channel model of (27) can be interpreted as an urban zone because the multipath and users are constantly moving. Markov channel of (28) indicates LOS but not as strong as channel 1, so it can be seen as a semi-urban area because

*Example 5.* Another three markovian channel models are proposed where it is indicated that each channel must be present in the Markov chain 80% of times. Probability transition

there are not a lot of tall buildings to block the transmission.

matrixes and steady-state vectors are shown in (32)-(37).

**3chan1 P** (26)

**3chan2 P** (27)

**3chan3 P** (28)

=1 0 0 **3chan1 π** (29)

=0 1 0 **3chan2 π** (30)

=0 0 1 **3chan3 π** (31)

$$\mathbf{P\_{3chand}} = \begin{bmatrix} 0.8 & 0.1 & 0.1 \\ 0.8 & 0.1 & 0.1 \\ 0.8 & 0.1 & 0.1 \end{bmatrix} \tag{32}$$

$$\mathbf{m\_{3cham1}} = \begin{bmatrix} 0.8 & 0.1 & 0.1 \end{bmatrix} \tag{33}$$

$$\mathbf{P\_{3cham5}} = \begin{bmatrix} 0.1 & 0.8 & 0.1 \\ 0.1 & 0.8 & 0.1 \\ 0.1 & 0.8 & 0.1 \end{bmatrix} \tag{34}$$

$$\mathbf{m\_{3cham1}} = \begin{bmatrix} 0.1 & 0.8 & 0.1 \end{bmatrix} \tag{35}$$

$$\mathbf{P\_{3cham6}} = \begin{bmatrix} 0.1 & 0.1 & 0.8 \\ 0.1 & 0.1 & 0.8 \\ 0.1 & 0.1 & 0.8 \end{bmatrix} \tag{36}$$

$$\mathbf{m\_{3cham1}} = \begin{bmatrix} 0.1 & 0.1 & 0.8 \end{bmatrix} \tag{37}$$

Results are shown in Figure 11 where each BER curve are very close to the curve resulted from the simulation of only statistical channels (according to each case), confirming what is indicated in each steady-state vector.

**Figure 11.** Three state Markov cannel for Example 5

*Example 6.* Once the behavior of the markovian channel model created with Matlab, probability transition matrix of (38) is proposed for the scenario explained above. This model indicates that the probability of a type of LOS (Rician channel K = 14 dB or K = 7 dB) is less than the probability when the user is moving (Rayleigh channel). This model focus on a mobile user and when there is a LOS but it is not the best conditions. The resulting curve presented in Figure 12 seems to follow a combination of the most probable statistical channel indicated in steady-state vector (but never equal to a particular channel), concluding that these model really represents a better characterization of the channel.

$$\mathbf{P\_{3chan7}} = \begin{bmatrix} 0.1166 & 0.5072 & 0.3762 \\ 0.0675 & 0.4682 & 0.4643 \\ 0.1507 & 0.5208 & 0.3285 \end{bmatrix} \tag{38}$$

Wireless Channel Model with Markov Chains Using MATLAB 253

**Figure 12.** Three state Markov cannel for example 6

P3chan7

Vucetic shown in (40) with these probabilistic channels:

Only Rice K=14 dB (Chan 1) Only Rayleigh (Chan 2) Only Rice K=7 dB (Chan 3)

Channel B: Rayleigh, mobile user and multipath.

The methodology applied to implement a markovian channel in a wireless communication system can be also used to create an n-state channel. Some authors have characterized channels up to four states. Let's take the probability transition matrix proposed by B.

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

Channel D: Rice K = 5 dB, a channel with more noise but not as bad conditions as

0.679 0.179 0.129 0.013

**4chan P** (40)

= 0.1753 0.4480 0.3171 0.0596 **4chan π** (41)

0 0 0.778 0.222

0.052 0.925 0.023 0 <sup>=</sup> 0.104 0.007 0.75 0.139

Computed steady-state vector of (41) was obtained by using property of (9).

**4.3. Four-state Markov channel model** 

10-3

10-2

BER

10-1

100

Channel A: Rice K = 14 dB, strong LOS.

Channel C: Rice K = 7 dB, regular LOS.

Rayleigh, user without movement.

$$\mathbf{m\_{3chan7}} = \begin{bmatrix} 0.1062 & 0.4940 & 0.4010 \end{bmatrix} \tag{39}$$

The effect of the combination of statistical channels is proved with the counting of events (Table 4). These data is very similar to the probability transition matrix of (38).


**Table 4.** Counting of events for **P3chan7**

**Figure 12.** Three state Markov cannel for example 6

#### **4.3. Four-state Markov channel model**

252 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

*Example 6.* Once the behavior of the markovian channel model created with Matlab, probability transition matrix of (38) is proposed for the scenario explained above. This model indicates that the probability of a type of LOS (Rician channel K = 14 dB or K = 7 dB) is less than the probability when the user is moving (Rayleigh channel). This model focus on a mobile user and when there is a LOS but it is not the best conditions. The resulting curve presented in Figure 12 seems to follow a combination of the most probable statistical channel indicated in steady-state vector (but never equal to a particular channel),

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

concluding that these model really represents a better characterization of the channel.

0.1166 0.5072 0.3762 = 0.0675 0.4682 0.4643 0.1507 0.5208 0.3285 

The effect of the combination of statistical channels is proved with the counting of events

(Table 4). These data is very similar to the probability transition matrix of (38).

Ch 1 to 2: 50.4 % Ch 2 to 2: 46.9 % Ch 3 to 2: 52.0 %

**3chan7 P** (38)

= 0.1062 0.4940 0.4010 **3chan7 π** (39)

Channel 1: 10.1 % Channel 2: 49.3 % Channel 3: 40.4 %

Cha 1 to 3: 38.1 % Ch 2 to 3: 47.0 % Ch 3 to 3: 33.0 %

**Figure 11.** Three state Markov cannel for Example 5

P3chan4 P3chan5 P3chan6

Only Rice K=14 dB (Chan 1) Only Rayleigh (Chan 2) Only Rice K=7 dB (Chan 3)

10-4

10-3

10-2

BER

10-1

100

Ch 1 to 1: 11.3 % Ch 2 to 1: 5.9 % Ch 3 to 1: 14.9 %

**Table 4.** Counting of events for **P3chan7**

The methodology applied to implement a markovian channel in a wireless communication system can be also used to create an n-state channel. Some authors have characterized channels up to four states. Let's take the probability transition matrix proposed by B. Vucetic shown in (40) with these probabilistic channels:


$$\mathbf{P\_{4chan}} = \begin{bmatrix} 0.679 & 0.179 & 0.129 & 0.013 \\ 0.052 & 0.925 & 0.023 & 0 \\ 0.104 & 0.007 & 0.75 & 0.139 \\ 0 & 0 & 0.778 & 0.222 \end{bmatrix} \tag{40}$$

Computed steady-state vector of (41) was obtained by using property of (9).

$$\mathbf{m}\_{\mathbf{4chan}} = \begin{bmatrix} 0.1753 & 0.4480 & 0.3171 & 0.0596 \end{bmatrix} \tag{41}$$

Through steady-state vector, this model establishes that the biggest probability is found between channel B (mobile user) and channel C (Rice K = 7 dB, regular LOS). This can be interpreted as an urban zone scenario where users are constantly moving and there is less possibility of line of sight. BER curve of Figure 13 shows this trend and the behavior of the markovian chain is proved by counting the transitions and states. These last results are confirmed in Table 5.

Wireless Channel Model with Markov Chains Using MATLAB 255

have a limit because maybe a large number of states in the chain could be exaggerated. Another analysis is suggested to demonstrate this hypothesis by proposing another markovian channels shown in Table 6. The common characteristic between all models is that Rayleigh channel (multipath, mobile user) has the biggest probability than a channel with

Channel 4: Rice K = 5 dB, the channel with more noise but "better" conditions than

Channel 5: AWGN, without any type of multiplicative fading. This is the channel with

Using the same methodology of all examples above, BER curve was computed and it is presented in Figure 14. It can be appreciated from graphic that the curve for two, three and four states are different between them; nevertheless five-state channel is very similar to fourstate model although they are not exactly the same. This is very peculiar because there is nothing similar to the other cases. So the conclusion is that until four-state markovian channel model is enough to characterize a wireless channel because results are going to be

some type of line of sight. The possible states are:

Channel 2: Rayleigh, mobile user and multipath.

best conditions because it represents practically no losses.

very similar with more states. (Sánchez-Salas & Cuevas-Ruíz, 2007)

0.32 0.68 <sup>=</sup> 0.25 0.75

0.1531 0.715 0.1319 = 0.1487 0.8221 0.0292 0.0714 0.816 0.1126 

0.679 0.179 0.129 0.013

0 0 0.778 0.222

0.25 0.25 0.2 0.25 0.05 0.08 0.25 0.3 0.25 0.12 = 0.1 0.2 0.4 0.2 0.1 0.1 0.15 0.4 0.25 0.1 0.05 0.2 0.32 0.18 0.25

**Table 6.** Markovian channels and steady-state vector for 1, 2, 3, 4 and 5 states

0.052 0.925 0.023 0 <sup>=</sup> 0.104 0.007 0.75 0.139

of states Transition Matrix Steady-State Vector

**AP** = 0.3 0.7 **<sup>A</sup> <sup>π</sup>**

**BP** = 0.14 0.8 0.06 **<sup>B</sup> π**

**CP** = 0.1753 0.4480 0.3171 0.0596 **<sup>C</sup> π**

**DP** = 0.11 0.201 0.349 0.2224 0.126 **<sup>D</sup> π**

Channel 1: Rice = 14 dB, strong LOS.

Channel 3: Rice K = 7 dB, regular LOS.

Rayleigh, user without movement.

Number

2

3

4

5


**Table 5.** Counting of events for **P3chan7**

**Figure 13.** Four-state Markov channel

#### **4.4. N-state Markov channel model**

It has been proved until this point that the more statistical channels in a Markov chain wireless channel model, the better the channel will be characterized, however this must have a limit because maybe a large number of states in the chain could be exaggerated. Another analysis is suggested to demonstrate this hypothesis by proposing another markovian channels shown in Table 6. The common characteristic between all models is that Rayleigh channel (multipath, mobile user) has the biggest probability than a channel with some type of line of sight. The possible states are:

Channel 1: Rice = 14 dB, strong LOS.

254 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

confirmed in Table 5.

Channel 1 to 1: 67.22 % Channel 2 to 1: 5.36 % Channel 3 to 1: 11 % Channel 4 to 1: 0 %

Channel 1 to 3: 12.53 % Channel 2 to 3: 3.06 % Channel 3 to 3: 74.98 % Channel 4 to 3: 81.50 %

**Table 5.** Counting of events for **P3chan7**

**Figure 13.** Four-state Markov channel

10-4

10-3

10-2

BER

10-1

100

**4.4. N-state Markov channel model** 

Only Rice K=14 dB (Chan 1) Only Rayleigh (Chan 2) Only Rice K=7 dB (Chan 3) Only Rice K=5 dB (Chan 4)

P4chan1

Through steady-state vector, this model establishes that the biggest probability is found between channel B (mobile user) and channel C (Rice K = 7 dB, regular LOS). This can be interpreted as an urban zone scenario where users are constantly moving and there is less possibility of line of sight. BER curve of Figure 13 shows this trend and the behavior of the markovian chain is proved by counting the transitions and states. These last results are

> Channel 1: 18.12 % Channel 2: 43.14 % Channel 3: 33.01 % Channel 4: 5.73 %

It has been proved until this point that the more statistical channels in a Markov chain wireless channel model, the better the channel will be characterized, however this must

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

Channel 1 to 2: 18.32 % Channel 2 to 2: 91.58 % Channel 3 to 2: 0.94 % Channel 4 to 2: 0 %

Channel 1 to 4: 1.93 % Channel 2 to 4: 0 % Channel 3 to 4: 13.09 % Channel 4 to 4: 18.50 %


Using the same methodology of all examples above, BER curve was computed and it is presented in Figure 14. It can be appreciated from graphic that the curve for two, three and four states are different between them; nevertheless five-state channel is very similar to fourstate model although they are not exactly the same. This is very peculiar because there is nothing similar to the other cases. So the conclusion is that until four-state markovian channel model is enough to characterize a wireless channel because results are going to be very similar with more states. (Sánchez-Salas & Cuevas-Ruíz, 2007)


**Table 6.** Markovian channels and steady-state vector for 1, 2, 3, 4 and 5 states

**Figure 14.** Comparison between n-states Markov channel model

#### **5. Semi-markovian channel model**

Now let's make the supposition that a process can be in any possible states (1,2,…,N) and each time goes to state i remains there for a certain random amount of time with media μ<sup>i</sup> and then makes a transition to state j with probability pij. This practice is called semimarkovian process and it is very similar to Markov chains because switches between states follow the Markov property. However, the remaining time in a state is a random variable with some probability distribution. (Ross, 2007)

The probability transition matrix for a semi-markovian process is shown in (42).

$$\mathbf{P} = \begin{bmatrix} 0 & \mathbf{P}\_{01} & \mathbf{P}\_{02} & \cdots \\ \mathbf{P}\_{10} & 0 & \mathbf{P}\_{12} & \cdots \\ \cdot & \cdot & \\ \mathbf{P}\_{i0} & \mathbf{P}\_{i1} & \mathbf{0} \\ \cdot & \cdot & \cdots & 0 \end{bmatrix} \tag{42}$$

Wireless Channel Model with Markov Chains Using MATLAB 257

0 1 <sup>=</sup> 1 0 

AB AC BA BC CA CB

0p p =p 0 p pp 0 

**P**

**P**

The evolution of a semi-markovian process is explained through probability transition matrix **P** and sojourn time vector **w** in this way: the process begins in state i and remains there for a mean amount of time wi and then switches to state j with probability pij; after that remains in state j for another mean amount of time wj and can switch to state k with probability pjk or return to state i with probability pji and so on. The transition diagram for a

two and three semi-markovian chain is shown in Figure 15 and 16.

**Figure 15.** Transition diagram for a 3-state semimarkovian process

**Figure 16.** Transition diagram for a 2-state semimarkovian process

understand better the application.

If time follows an exponential probability density function, the process is called "continoustime Markov process". When time in each state and transition is the same (time does not vary and generally is 1), then the process is called "discrete Markov chain", consequently

Semimarkovian process can be also applied to wireless channel model. The main difference between Markov chains and semimarkovian processes is that this last one includes the analysis of sojourn time in each state. In this way, the applications of the semi-markovian processes in a communication system centers in the analysis of the sojourn time in a particular condition. This can be useful to determine the performance of the designed communication system, the effectiveness of a fading mitigation technique in order to preserve optimal transmission conditions as long as possible, or to study some kind of fading that is only present in a certain hour or season, etc. An example is proposed to

the analyzed models above are a particular case of semi-markovian process.

The most relevant characteristic of the matrix above is that it has a zero diagonal matrix because it only considers transitions between states. The second important element in this kind of processes is the mean sojourn time wi in each state and it is represented as in (43).

$$\mathbf{w} = \begin{bmatrix} \mathbf{w}\_1 & \mathbf{w}\_2 & \dots & \mathbf{w}\_i \end{bmatrix} \tag{43}$$

The evolution of a semi-markovian process is explained through probability transition matrix **P** and sojourn time vector **w** in this way: the process begins in state i and remains there for a mean amount of time wi and then switches to state j with probability pij; after that remains in state j for another mean amount of time wj and can switch to state k with probability pjk or return to state i with probability pji and so on. The transition diagram for a two and three semi-markovian chain is shown in Figure 15 and 16.

**Figure 15.** Transition diagram for a 3-state semimarkovian process

256 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

**Figure 14.** Comparison between n-states Markov channel model

Now let's make the supposition that a process can be in any possible states (1,2,…,N) and each time goes to state i remains there for a certain random amount of time with media μ<sup>i</sup> and then makes a transition to state j with probability pij. This practice is called semimarkovian process and it is very similar to Markov chains because switches between states follow the Markov property. However, the remaining time in a state is a random variable

0 2 4 6 8 10 12 14 16

Eb/N0 (dB)

01 02 10 12

**P** (42)

12 i =w w … w **w** (43)

0p p … p 0p …

The probability transition matrix for a semi-markovian process is shown in (42).

i0 i1

pp 0 . . …0

The most relevant characteristic of the matrix above is that it has a zero diagonal matrix because it only considers transitions between states. The second important element in this kind of processes is the mean sojourn time wi in each state and it is represented as in (43).

= . .

**5. Semi-markovian channel model** 

2-State 3-State 4-State 5-State

10-4

10-3

10-2

BER

10-1

100

with some probability distribution. (Ross, 2007)

**Figure 16.** Transition diagram for a 2-state semimarkovian process

If time follows an exponential probability density function, the process is called "continoustime Markov process". When time in each state and transition is the same (time does not vary and generally is 1), then the process is called "discrete Markov chain", consequently the analyzed models above are a particular case of semi-markovian process.

Semimarkovian process can be also applied to wireless channel model. The main difference between Markov chains and semimarkovian processes is that this last one includes the analysis of sojourn time in each state. In this way, the applications of the semi-markovian processes in a communication system centers in the analysis of the sojourn time in a particular condition. This can be useful to determine the performance of the designed communication system, the effectiveness of a fading mitigation technique in order to preserve optimal transmission conditions as long as possible, or to study some kind of fading that is only present in a certain hour or season, etc. An example is proposed to understand better the application.

*Example 7.* A three-state semimarkovian wireless channel model with probability transition matrix of (44) and mean sojourn time of (45) must be created. The remaining time follows an exponential probability density function. Analyze the model and give an interpretation of results for a wireless communication system like the one of Fig. 5.

$$\mathbf{P\_{3semiM}} = \begin{bmatrix} 0 & 0.5072 & 0.4928 \\ 0.5357 & 0 & 0.4643 \\ 0.1507 & 0.8493 & 0 \end{bmatrix} \tag{44}$$

$$\mathbf{w}\_{\text{3semi}\mathbf{M}} = \begin{bmatrix} \mathbf{2} & \mathbf{0}.4 & \mathbf{5} \end{bmatrix} \tag{45}$$

Wireless Channel Model with Markov Chains Using MATLAB 259

 *elseif channel(1,i-1) == 3 %If former sample was channel 3* 

 *eventW = randint(1,1,[1 100])/100; %Event to decide the sojourn time* 

 *timeState1(1,i) = -w(1)\*log(eventW); %Sojourn time when Channel 1 appears* 

 *timeState1(1,i) = -w(2)\*log(eventW); %Sojourn time when Channel 2 appears* 

 *timeState1(1,i) = -w(3)\*log(eventW); %Sojourn time when Channel 3 appears* 

*timeState = cumsum(timeState1); %Sojourn time for each element of the created chain* 

Next figure shows obtained results of how many time remains the process in each statistical channel by using the Matlab code above. It can be observed the time and exact moment when each channel is presented. The graphic can be useful in case a record of some

50 100 150 200 250 300

Time [s]

 *if eventP < P1(3,1) %Switch to channel 1* 

 *else %Switch to channel 2* 

phenomenon or fading exists, for example, the rain.

**Figure 17.** Three state semimarkovian channel

0

0.5

1

1.5

2

State (Type of Channel)

2.5

3

3.5

4

 *channel(1,i) = 1;* 

 *channel(1,i) = 2; end; end; end* 

*% Sojourn time for i = 1:lengthChain* 

 *if channel(i) == 1* 

 *else* 

 *end; end* 

 *elseif channel(i) == 2* 

The statistical channels that form this model are:


#### Solution:

Markov chains Matlab code created in previous sections can be modified to create a semimarkovian process. The main change is that another random number is needed to determine the time in which the state will remain. The code is shown next.

*function [channel,timeState] = semiMarkov3States(lengthChain,P,w,channel1)* 



results for a wireless communication system like the one of Fig. 5.

The statistical channels that form this model are:

Channel 2: Rayleigh, multipath and moving user.

the time in which the state will remain. The code is shown next.

*P1 = cumsum(P,2); % P'3chan* 

*function [channel,timeState] = semiMarkov3States(lengthChain,P,w,channel1)* 

*timeState = zeros(1,lengthChain); % Vector of time in each state timeState1= zeros(1,lengthChain); % Auxiliary vector of time channel(1,1) = channel1; % First sample of the process* 

 *eventP = randint(1,1,[1 100])/100; %Event to decide the switch if channel(1,i-1) == 1 %If former sample was channel 1* 

 *elseif channel(1,i-1) == 2 %If former sample was channel 2* 

 *if eventP < P1(1,2) %Switch to channel 2* 

 *else %Switch to channel 3* 

 *if eventP < P1(2,1) %Switch to channel 1* 

 *else %Switch to channel 3* 

*channel = zeros(1,lengthChain); % 3-state Markov chain (output vector).* 

Channel 1: Rice K = 14 dB, strong LOS.

Channel 3: Rice K = 7 dB, regular LOS.

Solution:

*for i = 2:lengthChain* 

 *channel(1,i) = 2;* 

 *channel(1,i) = 3;* 

 *channel(1,i) = 1;* 

 *channel(1,i) = 3;* 

 *end* 

 *end* 

*Example 7.* A three-state semimarkovian wireless channel model with probability transition matrix of (44) and mean sojourn time of (45) must be created. The remaining time follows an exponential probability density function. Analyze the model and give an interpretation of

Markov chains Matlab code created in previous sections can be modified to create a semimarkovian process. The main change is that another random number is needed to determine

0 0.5072 0.4928 = 0.5357 0 0.4643 0.1507 0.8493 0 

**P3semiM** (44)

= 2 0.4 5 **w3semiM** (45)

Next figure shows obtained results of how many time remains the process in each statistical channel by using the Matlab code above. It can be observed the time and exact moment when each channel is presented. The graphic can be useful in case a record of some phenomenon or fading exists, for example, the rain.

**Figure 17.** Three state semimarkovian channel

However this image may not be very clear at first sight. Probability transition matrix and sojourn time vector gives a good description of the channel. Also the steady-state vector can be computed using equation (9), which is shown in (46).

$$\mathbf{m}\_{\text{3seemiM}} = \begin{bmatrix} 0.2680 & 0.4097 & 0.3223 \end{bmatrix} \tag{46}$$

Wireless Channel Model with Markov Chains Using MATLAB 261

A better choice to wireless channel modeling is Markov chains which are a type of stochastic processes and are based on the probability of an event given another past event. This type of model offers the combination of statistical channels. For this reason it is necessary to establish certain number of states for the probability transition matrix, which characterizes the channel. The larger the number of states (statistical channels) in the markovian chain, the better the channel is modeled but there is also a limit. The elements that model a Markov

Markov chains are a special case of semi-markovian processes. The main difference between them is that in the latter there are no transitions to the same state and have another element: the sojourn vector. This vector represents the mean time of sojourn of a state. This type of model gives information about how many time and in what exact moment stays in a particular state, therefore its application could be the analysis of time of a particular condition (LOS, multipath, shadows) or a cause of fading (rain, scintillation, snow). This model can be also useful to know the performance of the communication system or some

Since the methodology exposed in this chapter is very flexible, explained models can be applied with other characteristics. Given the bases for a markovian and semi-markovian channel, the lector is invited to develop another application for wireless telecommunication

Diana Alejandra Sánchez-Salas, José Luis Cuevas-Ruíz and Miguel González-Mendoza

Abouraddy, A.F.; Elnoubi, S.M.; (Sep 2000), Statistical modeling of the indoor radio channel at 10 GHz through propagation measurements .I. Narrow-band measurements and modeling, Vehicular Technology, IEEE Transactions on, vol.49, no.5, pp.1491-1507, ISSN

Feller, W. (1957). An Introduction to Probability Theory and Its Applications, Vol. 1, Second

Kijima, Masaaki. (1997). Markov Processes for Stochastic Modeling. Cambridge, England.

Lutz, E.; Cygan, D.; Dippold, M.; Dolainsky, F.; Papke, W.; , (May 1991), The land mobile satellite communication channel-recording, statistics, and channel model, Vehicular

Technology, IEEE Transactions on , vol.40, no.2, pp.375-386, ISSN : 0018-9545. Nakagami, M.; (1960), The M-Distribution – A General Formula of Intensity Distribution of Rapid Fading, In W.C. Hoffman, Statistical Methods in Radio Wave Propagation,

*Tecnológico de Monterrey, Campus Estado de México, México* 

edition, Wiley, ISBN 0-471-25709-5.

Pergamon Press, New York.

The University Press. ISBN 0-412-60660-7.

chains channel model are the probability transition matrix and steady-state vector.

fading mitigation technique.

channels.

**Author details** 

**7. References** 

: 0018-9545.

From (45) and (46) it is observed that although channel 3 has not the largest probability, it does have the largest sojourn time of all of them. In other words, it is probable that channel with regular LOS is not experimented by the user so often but when it does it, remains there for much more time than any other channel. On the other hand, although the channel with multipath has the largest probability, it is not to be for a large amount of time and it will switch to better conditions (strong or regular LOS). The behavior of these channels seems to characterize an environment in an urban zone where there are mobile users or there are many obstacles. In this type of situations it is necessary to compensate multipath by designing a link between transmitter and receiver with effective fading mitigation techniques, this is why this type of channel remains shorts periods of time.

To prove all what was said above, the counting of transitions and states for the simulated semi-Markov process was done.


**Table 7.** Counting of events for **P3semiM**

The percentage of each transition is practically the same as the original transition matrix of (44), especially because there were no transitions to the same state in the semi-markovian process created. The percentages observed in the second row of Table 7 are the data of the steady state vector of (46). Finally, the same mean sojourn times was obtained than the one indicated in (45) proving the simulated process is correct.

## **6. Conclusion**

The characterization of a wireless channel has become fundamental in the design of a communication system because of the rapid growing of telecommunications. The basic models are based on probability density functions although they represent real perturbations when a signal is sent through air, their characteristics are not enough because a real channel is composed by the combination of many statistical models.

A better choice to wireless channel modeling is Markov chains which are a type of stochastic processes and are based on the probability of an event given another past event. This type of model offers the combination of statistical channels. For this reason it is necessary to establish certain number of states for the probability transition matrix, which characterizes the channel. The larger the number of states (statistical channels) in the markovian chain, the better the channel is modeled but there is also a limit. The elements that model a Markov chains channel model are the probability transition matrix and steady-state vector.

Markov chains are a special case of semi-markovian processes. The main difference between them is that in the latter there are no transitions to the same state and have another element: the sojourn vector. This vector represents the mean time of sojourn of a state. This type of model gives information about how many time and in what exact moment stays in a particular state, therefore its application could be the analysis of time of a particular condition (LOS, multipath, shadows) or a cause of fading (rain, scintillation, snow). This model can be also useful to know the performance of the communication system or some fading mitigation technique.

Since the methodology exposed in this chapter is very flexible, explained models can be applied with other characteristics. Given the bases for a markovian and semi-markovian channel, the lector is invited to develop another application for wireless telecommunication channels.

## **Author details**

260 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 2

be computed using equation (9), which is shown in (46).

periods of time.

**6. Conclusion** 

semi-Markov process was done.

Channel 1 to 1: 0 % Channel 2 to 1: 50.61 % Channel 3 to 1: 14.33 %

**Table 7.** Counting of events for **P3semiM**

Channel 1: 25.50 % Channel 2: 41 % Channel 3: 33.50 %

indicated in (45) proving the simulated process is correct.

However this image may not be very clear at first sight. Probability transition matrix and sojourn time vector gives a good description of the channel. Also the steady-state vector can

From (45) and (46) it is observed that although channel 3 has not the largest probability, it does have the largest sojourn time of all of them. In other words, it is probable that channel with regular LOS is not experimented by the user so often but when it does it, remains there for much more time than any other channel. On the other hand, although the channel with multipath has the largest probability, it is not to be for a large amount of time and it will switch to better conditions (strong or regular LOS). The behavior of these channels seems to characterize an environment in an urban zone where there are mobile users or there are many obstacles. In this type of situations it is necessary to compensate multipath by designing a link between transmitter and receiver with effective fading mitigation techniques, this is why this type of channel remains shorts

To prove all what was said above, the counting of transitions and states for the simulated

Channel 1 to 2: 48.24 % Channel 2 to 2: 0 % Channel 3 to 2: 85.67 %

The percentage of each transition is practically the same as the original transition matrix of (44), especially because there were no transitions to the same state in the semi-markovian process created. The percentages observed in the second row of Table 7 are the data of the steady state vector of (46). Finally, the same mean sojourn times was obtained than the one

The characterization of a wireless channel has become fundamental in the design of a communication system because of the rapid growing of telecommunications. The basic models are based on probability density functions although they represent real perturbations when a signal is sent through air, their characteristics are not enough because

a real channel is composed by the combination of many statistical models.

= 0.2680 0.4097 0.3223 **3semiM π** (46)

Channel 1 to 3: 51.76 % Channel 2 to 3: 49.39 % Channel 3 to 3: 0 %

Mean time in Channel 1: 1.87 Mean time in Channel 2: 0.38 Mean time in Channel 3: 5.12 Diana Alejandra Sánchez-Salas, José Luis Cuevas-Ruíz and Miguel González-Mendoza *Tecnológico de Monterrey, Campus Estado de México, México* 

## **7. References**

	- Nelson, Barry. (2002). Stochastic Modeling: Analysis & Simulation. USA. Dover Publications Inc. ISBN 0-07-046213-5.

**Chapter 12** 

© 2012 Ali, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use,

distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Ali, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

A wireless sensor network consists of spatially distributed autonomous sensors to cooperatively monitor physical or environmental conditions, such as temperature, sound, vibration, pressure, motion or pollutants. The development of wireless sensor networks was motivated by military applications such as battlefield surveillance. They are now used in many industrial and civilian application areas, including industrial process monitoring and control, machine health monitoring, environment and habitat monitoring, healthcare

A smart sensor node is a combination of sensing, processing and communication technologies. Figure 1 shows the basic architectural components of a sensor node. The sensing unit senses the change of parameters, signal conditioning circuitry prepares the electrical signals to convert to the digital domain, the sensed analog signal is converted and is used as the input to the application algorithms or processing unit, the memory helps processing of tasks and the transceiver is used for communicating with other sensors or the

Sensors can monitor temperature, pressure, humidity, soil makeup, vehicular movement, noise levels, lighting conditions, the presence or absence of certain kinds of objects or substances, mechanical stress levels on attached objects, and other properties. Their mechanism may be seismic, magnetic, thermal, visual, infrared, acoustic, or radar. A smart sensor is also capable of self-identification and self-diagnosis. The mechanisms of smart sensors work in one of three ways: by a line of sight to the target (such as visual sensors), by proximity to target (such as seismic sensors), and by propagation like a wave with possible

**Simulation Framework of Wireless** 

**Sensor Network (WSN) Using** 

**MATLAB/SIMULINK Software** 

Additional information is available at the end of the chapter

applications, home automation, and traffic control [1-2].

base stations or sinks in WSN[3], see figure 1.

bending (such as acoustic sensors)[4,5].

Qutaiba I. Ali

**1. Introduction** 

http://dx.doi.org/10.5772/46467

Parsons, J.D. (1996). The Mobile Radio Propagation Channel, USA, Wiley, ISBN 0471964158


**Chapter 12** 
