Generate two correlated random sequences

PoorBelow averageAverageGoodExcellent (9 votes, average: 3.78 out of 5)

This article discusses the method of generating two correlated random sequences using Matlab. If you are looking for the method on generating multiple sequences of correlated random numbers, I urge you to go here.

Generating two vectors of correlated random numbers, given the correlation coefficient \rho, is implemented in two steps. The first step is to generate two uncorrelated random sequences from an underlying distribution. Normally distributed random sequences are considered here.

This article is part of the book
Wireless Communication Systems in Matlab (second edition), ISBN: 979-8648350779 available in ebook (PDF) format and Paperback (hardcopy) format.

Step 1: Generate two uncorrelated Gaussian distributed random sequences X_1, X_2

x1=randn(1,100); %Normal random numbers sequence 1
x2=randn(1,100); %Normal random numbers sequence 2
subplot(1,2,1); plot(x1,x2,'r*');
title('Uncorrelated RVs X_1 and X_2');
xlabel('X_1'); ylabel('X_2');

Step 2: Generate correlated random sequence z

In the second step, the required correlated sequence is generated as

Z=\rho X_1 + \sqrt{1-\rho^2} X_2

rho=0.9;
z=rho*x1+sqrt(1-rhoˆ2)*x2;%transformation
subplot(1,2,2); plot(x1,z,'r*');
title(['Correlated RVs X_1 and Z , \rho=',num2str(rho)]);
xlabel('X_1'); ylabel('Z');

The resulting sequence Z will have \rho correlation with respect to X_1

Results plotted below.

Scatter plot of Two Correlated Random sequences that were generated
Figure : Scatter plots – Correlated random variables Z and X_1 on right

Continue reading this article on the method to generate multiple vectors of correlated random numbers.

Rate this article: PoorBelow averageAverageGoodExcellent (9 votes, average: 3.78 out of 5)

Further reading

[1] Richard Taylor, “Interpretation of correlation coefficient: A basic review”, Journal of diagnostic medical sonography, Jan/Feb 1990.↗

Topics in this chapter

Random Variables - Simulating Probabilistic Systems
● Introduction
Plotting the estimated PDF
● Univariate random variables
 □ Uniform random variable
 □ Bernoulli random variable
 □ Binomial random variable
 □ Exponential random variable
 □ Poisson process
 □ Gaussian random variable
 □ Chi-squared random variable
 □ Non-central Chi-Squared random variable
 □ Chi distributed random variable
 □ Rayleigh random variable
 □ Ricean random variable
 □ Nakagami-m distributed random variable
Central limit theorem - a demonstration
● Generating correlated random variables
 □ Generating two sequences of correlated random variables
 □ Generating multiple sequences of correlated random variables using Cholesky decomposition
Generating correlated Gaussian sequences
 □ Spectral factorization method
 □ Auto-Regressive (AR) model

Books by the author

Wireless Communication Systems in Matlab
Wireless Communication Systems in Matlab
Second Edition(PDF)

PoorBelow averageAverageGoodExcellent (159 votes, average: 3.81 out of 5)

Digital modulations using Python
Digital Modulations using Python
(PDF ebook)

PoorBelow averageAverageGoodExcellent (122 votes, average: 3.60 out of 5)

digital_modulations_using_matlab_book_cover
Digital Modulations using Matlab
(PDF ebook)

PoorBelow averageAverageGoodExcellent (125 votes, average: 3.69 out of 5)

Hand-picked Best books on Communication Engineering
Best books on Signal Processing

Post your valuable comments !!!