Professional Documents
Culture Documents
(EL-323)
LABORATORY MANUAL
____________________________________________________________________________________________________________________________________________________________
Introduction
In this lab we will implemet methods for generating random variables and samples of
random processes in MATLAB. We begin with the implementation of a method for generating
random variables with a specified probability distribution function. Then we will analyze the
characterization of a stationary random process by its autocorrelation in the time domain and by its
power spectrum in the frequency domain using MATLAB. Because linear filters play a very
important role in communication systems, we will also implement the autocorrelation function and
the power spectrum of a linearly filtered random process. At the end of this lab we will analyse the
characteristics of lowpass and bandpass random processes using MATLAB.
Generation of Random Variables:
Random number generators are often used in practice to simulate the effect of noise like signals and
other random phenomena that are encountered in the physical world. Such noise is present in
electronic devices and systems and usually limits our ability to communicate over large distances
and to detect relatively weak signals. By generating such noise on a computer, we are able to study
its effects through simulation of communication systems and to assess the performance of such
systems in the presence of noise.
Most computer software libraries include a uniform random number generator. Such a random
number generator generates a number between 0 and 1 with equal probability. We call the output of
the random number generator a random variable. The uniform probability density function for the
random variable A, denoted as f (A ) is illustrated in Figure 2.1(a).
_____________________________________________________________________________________________
Page 2 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
We note that the average value or mean value of A, denoted as m A, is m A =1/2. The integral of the
probability density function, which represents the area under f (A ) is c=alled the probability
distribution function of the random variable A and is defined as
A
F ( A )=∫ f ( x )dx
−∞
For any random variable, this area must always be unity, which is the maximum value that can be
achieved by a distribution function. Hence, for the uniform random variable A we have
A
F ( A )=∫ f (x )dx =1
−∞
and the range of F(A) is 0 < F(A) < 1 for 0 < A < 1. The probability distribution
function is shown in Figure 2.1(b). If we wish to generate uniformly distributed noise in an interval
(b, b + 1), it can be accomplished simply by using the output A of the random number generator and
shifting it by an amount b. Thus a new random variable B can be defined as
B= A+ b
1
which now has a mean value m B =b+ . For example, if b = -0.5, the random variable B is
2
uniformly distributed in the interval (- 0.5, 0.5), as shown in Figure 2.2(a). Its probability
distribution function F(B) is shown in Figure 2.2(b). A uniformly distributed random variable in the
range (0,1) can be used to generate random variables with other probability distribution functions.
For example, suppose that we wish to generate a random variable C with probability distribution
function F(C), as illustrated in Figure 2.3.
Because the range of F (C) is the interval (0,1), we begin by generating a uniformly distributed
random variable A in the range (0,1). If we set
_____________________________________________________________________________________________
Page 3 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
F ( C )= A 2.1 ¿
C=F−1 A 2.2 ¿
Thus we solve the 2.1) for C, and the solution in 2.2) provides the value of C for which F ( C )= A.
By this means we obtain a new random variable C with probability distribution function F(C). This
inverse mapping from A to C is illustrated in Figure 2.3.
Problem 01:
Generate a random variable C that has the linear probability density function shown in Figure
2.4(a); that is,
In modeling thermal noise that is generated in electronic devices used in the implementation of
communication systems, we often assume that such noise is a white random process. Such a process
is defined as follows.
_____________________________________________________________________________________________
Page 4 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
Definition: A random process X (t) is called a white process if it has a flat power spectrum—that is,
if S x ( f ) is a constant for all f . As indicated above, the importance of white processes stems from the
fact that thermal noise can be closely modeled as spectrally constant over a wide range of
frequencies . Also, a number of processes that are used to describe a variety of information sources
are modeled as the output of LTI systems driven by a white process. We observe, however, that if
S x ( f )=C for all f , then
∞ ∞
∫ S x ( f ) df = ∫ C df =∞
−∞ −∞
Thermal noise, although not precisely white, can be modeled for all practical purposes as a white
N
process. The power-spectral density of thermal noise is usually given as S x ( f )= 0 and is
2
sometimes referred to as the two-sided power-spectral density, emphasizing that this spectrum
extends to both positive and negative frequencies. We will avoid this terminology throughout and
simply use power spectrum or power-spectral density. For a white random process X(t) with power
N
spectrum S x ( f )= 0 , the autocorrelation function R x ( τ ) is
2
∞
j 2 πfτ N 0 ∞ j 2 πfτ N
R x ( τ )= ∫ S x ( f ) e df = ∫ e df = 0 δ (τ )
−∞ 2 −∞ 2
where δ (τ ) is the unit impulse. Consequently, for all τ ≠ 0, we have R x ( τ )=0 that is, if we sample a
white process at two points t 1∧t 2(t 1 ≠ t 2), the resulting random variables will be uncorrelated. If,
in addition to being white, the random process is Gaussian, the sampled random variables will be
statistically independent Gaussian random variables.
Problem 02:
Generate a discrete-time sequence of N =1000 i.e. uniformly distributed random numbers in the
interval (-0.5,0.5) and compute the estimate of the autocorrelation of the sequence {Xn},
Also, compute the power spectrum of the sequence {Xn} by evaluating the discrete
Fourier transform (DFT) of ^
R x (m) ,The DFT, which is efficiently computed by use of
the FFT algorithm, is defined as
_____________________________________________________________________________________________
Page 5 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
Problem 03:
A bandlimited random process X(t) has the power spectrum
Compute the autocorrelation R x ( τ ), for the random process whose power spectrum is given above.
It follows that the output of the linear filter is the random process
∞
Y (t )=∫ X (t) h(t−τ) dτ
−∞
Problem 04:
Suppose that a white random process X(t) with power spectrum S x (f ) = 1 for all f excites a linear
filter with impulse response
_____________________________________________________________________________________________
Page 6 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
Problem 05:
Compute the autocorrelation function R y (τ) corresponding to S y ( f ) in Problem 04 for
the specified S x (f ) = 1.
Problem 06:
Suppose that a white random process with samples {X{n)} is passed through a linear filter with
impulse response
_____________________________________________________________________________________________
Page 7 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
where X C ( t ) and X S ( t ) are called the in-phase and quadrature components of X(t). The random
processes X C ( t ) and X S ( t ) are lowpass processes.
Theorem: If X(t) is a zero-mean, stationary random process, the processes X C ( t ) and X S ( t ) are also
zero-mean, jointly stationary processes.The autocorrelation function of the bandpass process X(t)
is expressed in terms of the autocorrelation function Rc (t) and the cross-correlation function Rcs
(t) as
R x ( τ )=RC ( τ ) cos ( 2 π f 0 τ )−R CS ( τ ) sin ( 2 π f 0 τ )
Problem 07:
Consider the problem of generating samples of a lowpass random process by passing a white noise
sequence {Xn} through a lowpass filter. The input sequence is an i.e. sequence of uniformly
distributed random variables on the interval (- 0.5, 0.5). The lowpass filter has the impulse response
Problem 08:
Generate samples of a Gaussian bandpass random process by first generating samples of two
statistically independent Gaussian random processes Xc(t) and Xs(t) and then using these to
modulate the quadrature carriers cos 2 π f 0 t and sin 2 π f 0 t , as shown in below given figure
Student's feedback (Try giving useful feedback, e.g. did this lab session help you in learning, how to
improve student's learning experience, was the staff helpful, etc):
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________________________
Page 8 of 9
Lab #
Analogue and Digital National University Roll No: __________
Communication Lab
(EL323)
of Computer and Emerging Sciences
Islamabad Fall 2016
10
____________________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
Correctness of
TOTAL
AWARDED
Attitude
Neatness
Conclusion
Originality
Initiative
MARKS
TOTAL 10 10 10 20 20 30 100
EARNED
_____________________________________________________________________________________________
Page 9 of 9