Communication Systems Lab
Experiment # 4
OBJECTIVE
The objective of this lab is that students should get familiarized with the basic concept of correlation of
signals. Students will implement correlation of signals in MATLAB. By using two signals students will
compute correlation coefficient. Students will get a firm grip on integration in MATLAB as well.
INTRODUCTION
a) Correlation:
“The correlation is one of the most common and most useful statistics. A correlation is a single
number that describes the degree of relationship between two variables”. The mathematical relation for
computing the correlation coefficient between two signals is given by:
----------------------- (1)
Where,
g(t) and x(t) are the two signals that are being correlated and Eg and Ex are the respective energies.
Cn = 1 means maximum similarity (Best friends)
Cn = -1 means maximum dissimilarity (Worst enemies)
Cn = 0 means uncorrelated signals (Complete strangers)
b) Correlation functions:
Consider the application of correlation to signal detection in radar, where a signal pulse is transmitted in
order to detect a suspected target. If a target is present, the pulse will be reflected by it. If no target is
present, there will be no reflected pulse, just a noise. By detecting the presence or absence of the reflected
pulse we confirm the presence or absence of target. By measuring the time delay between the transmitted
and the reflected pulses we determine the distance of the target. Let the transmitted and the reflected
pulses be denoted by g(t) and z(t), respectively the correlation coefficient is given by:
------------------------------------ (2)
Thus, the correlation is zero because the pulses are disjoint (non-overlapping in time). The above integral
will yield zero value even when the pulses are identical but the relative time shift. To avoid this difficulty,
we compare the transmitted pulse g(t) with the received pulse z(t) shifted by τ. If for some value of τ,
there is a strong correlation, we not only detect the presence of the pulse but we also detect the relative
time shift of z(t) with respect to g(t). For this reason, instead of using the integral on the right hand, we
modified the integral as the cross-correlation function of two real signals g(t) and z(t):
----------------------------------------- (3)
Here z(t + τ) is the pulse z(t) left shifted by τ seconds. Therefore the above integral is an indication of
similarity (correlation) of g(t) with z(t) left shifted by τ seconds.
The correlation of a signal with itself is called autocorrelation. The autocorrelation function of a real
signal g(t) is defined as:
-------------------------------------- (4)
References:
Modern analog and digital communication by B.P Lathi.
Communication systems by Proakis, Salehi.
PROCEDURES
For the sake of understanding an example from course book (Modern analog and digital
communication by B.P. Lathi Page 37) is taken. Read out the statement of the example and
implement on MATLAB. You are required to implement using equation 1.
Before that it is very important to understand the integration techniques in MATLAB. For that
purpose open an M-file and perform following each step.
Symbolic and Numerical Integration in MATLAB
a) Symbolic Integration
b) Numerical Integration:
MATLAB has a primary tool for the numerical evaluation of integrals of real-valued functions, the
quad and integral command which uses an adaptive Simpson’s method (You need to study it through
some search material).
Integral
q = integral(fun,xmin,xmax) numerically integrates function fun from xmin to xmax using global adaptive
quadrature and default error tolerances.
Create the function f(x)=e−x2(lnx)2.
fun = @(x) exp(-x.^2).*log(x).^2;
Evaluate the integral from x=0 to x=Inf.
q = integral(fun,0,Inf)
q = 1.9475
Lab Task:
Find the correlation coefficient Cn between the pulse x(t) and pulses gi(t), i = 1,2,3,4,5,6,
shown in Fig. 2.18.
1) Plot each signal with proper labels.
2) Calculate Energy of each signal using integral command, sum command and for
loop.
3) Calculate Correlation Coefficient of each signal with x(t) using integral command,
sum command and for loop.