Version 1.
Department of Electrical Engineering
EE 322 – Analog and Digital Communication
Lab – 3
Random Variables, Random Processes and Autocorrelation
using MATLAB
Student Name Student ID Marks
Date: _______________________
Instructors: Zulaikha Kiran, Qaseem Sajjad
1
Version 1.0 – Zulaikha Kiran – 11/02/2019
Spring 2019 ADC Lab 3 Version 1.0
Introduction
The purpose of this lab is to enable the students to generate random signals, compute
autocorrelation and energy spectral density using MATLAB.
Course Learning Outcomes
CLO2: Develop software simulations to observe the performance of communications
systems.
CLO3: Report desired results proofs and calculations.
Equipment
Software
o MATLAB
Instructions
This is an individual lab. You will perform the tasks individually and submit the
required files at the end of the lab.
There will be no concept of make-up labs. The lab if missed may be performed later
for practice and knowledge required for the coming labs, but it will not be graded.
There will be two submissions for this lab.
o A single .m file containing all tasks and exercises separated by a commented
line will have to be uploaded to LMS. The code should be executable, and
must display results of all tasks when run. The name of the file must be
Lab<labno>_<UETno>_<Name> e.g. Lab2_123_Xyz.
o A lab handout containing questions for different tasks will have to be filled
and handed in at the end of the lab.
Plagiarism or any hint thereof will be dealt with strictly. Any incident where
plagiarism is caught, both (or all) students involved will be given zero marks,
regardless of who copied whom. Multiple such incidents will result in disciplinary
action being taken.
2
Spring 2019 ADC Lab 3 Version 1.0
Given Functions
The following code generates 5000 samples of a random variable uniformly distributed over the [-1,1]
interval, and plots its histogram using 50 bins.
X1 = -1+(1-(-1))*rand(5000,1);
figure, hist(X1,50);
The following code generates 5000 samples of a random integer uniformly distributed over the [1, 6]
interval, and plots its histogram using 50 bins.
X2 = randi(6,5000,1);
figure, hist(X2,50)
The following code generates 5000 samples of a random variable normally distributed with mean 10
and standard deviation 3, and plots its histogram using 50 bins.
X3 = 10+3.*randn(5000,1);
figure, hist(X3,50);
3
Spring 2019 ADC Lab 3 Version 1.0
Task 1 – Random Variables Generation
Exercise 1
Write a MATLAB code to generate 5000 samples of a random variable uniformly
distributed over the 0 to 2π interval. Plot its histogram using 10 bins.
Exercise 2
Write a MATLAB code to generate 5000 samples of a card chosen from a deck of 52
cards. Plot its histogram using 200 bins.
Exercise 3
Write a MATLAB code to generate 5000 samples of a Gaussian random variable
N(0,1). Plot its histogram using 10 bins.
Task 2 – Random Signal Generation
Exercise 4
Write a MATLAB code to generate a random process defined by
( ) ( )
Where θ is a single random variable uniformly distributed over the 0 to 2π interval.
Plot this signal.
Exercise 5
Write a MATLAB code to generate a random process defined by
( ) ( )
Where A is the random variable generated in Exercise 3. Plot the 500th instance of this
process.
Task 3 – Expectation
Exercise 6
Write a MATLAB code to find and plot the expectation of the random processes
defined in Exercise 4 and 6 in the 0 to 0.01 second interval. The signals will have to
be defined again with symbolic θ and A respectively, since they will need to be
integrated with respect to these variables for calculation of expectation.
4
Spring 2019 ADC Lab 3 Version 1.0
Task 4 – Autocorrelation
Exercise 7
Generate a discrete time sequence of N = 1000 statistically independent and uniformly
distributed random variables in the interval [-1/2, 1/2]
Compute the autocorrelation of the sequence using MATLAB function and plot it.
Bonus - Task 5
Exercise 8
Generate a random process given below, where A is uniformly distributed on [0, 1]
( ) ( )
Prove that the above process is cyclo-stationary (i.e. its mean and autocorrelation are
periodic in time)
5
Version 1.0
ADC Lab 2 Rubric
Method of Evaluation: Executable code, Filled lab document, In-lab marking by instructors
Measured Learning Outcomes: CLO2: Develop software simulations to observe the performance of communications systems.
CLO3: Report desired results proofs and calculations.
Excellent Good Satisfactory Unsatisfactory 3-1 Poor Marks
10 9-7 6-4 0 Obtained
Task All tasks completed Most tasks completed Some tasks completed correctly Most tasks incomplete or All tasks incomplete
Completion correctly in given time correctly in given time in given time incorrect by the end of or incorrect by the
(CLO2) lab session end of lab session
Code Correct code, easily Correct code but Slightly incorrect code with Incorrect code with Code not submitted
(CLO2) understandable with without proper proper comments improper format and no
comments where indentation or comments
necessary comments
Output Output correctly shown Most Some Output/Figures/Plots Most of the required Output/Figures/Plots
(CLO2) with all Figures/Plots Output/Figures/Plots displayed with proper labels OR Output/Figures/Plots not not displayed
displayed as required and displayed with proper Most Output/Figures/Plots displayed
properly labelled labels displayed but without proper
labels
Lab Report Required document Required document Some correct/ meaningful Answers not Report/Hand-out not
(CLO3) filled-in neatly with filled-in neatly with answers and conclusions with understandable/ not submitted
meaningful answers to meaningful answers to some irrelevant ones. Some relevant to questions.
all questions, proper most questions, and parts of the document not neat Conclusions not based on
grammar and proper conclusions or some grammar mistakes results. Illegible writing
punctuation with proper drawn with some with no proper
conclusions drawn grammar mistakes grammar/punctuation
Total
6
Version 1.0 – Zulaikha Kiran – 28/01/2019