Class 8 Notes
Class 8 Notes
5
Correlation of Signals Correlation of Signals
• y[n] is said to be shifted by � samples to the • If y[n] is made the reference signal and shift
right with respect to the reference sequence x[n] with respect to y[n], then the
x[n] for positive values of �, and shifted by � corresponding cross-correlation sequence is
samples to the left for negative values of given by
• The ordering of the subscripts xy in the ryx [�] � ��
n � �� y[n]x[n � � ]
definition of rxy [�] specifies that x[n] is the
reference sequence which remains fixed in � ��
m � �� y[m � �]x[m] � rxy [�� ]
time while y[n] is being shifted with respect
to x[n] • Thus, ryx [�] is obtained by time-reversing
rxy [�]
31 Copyright © 2005, S. K. Mitra 32 Copyright © 2005, S. K. Mitra
6
Properties of Autocorrelation and Properties of Autocorrelation and
Cross-
Cross-correlation Sequences Cross-
Cross-correlation Sequences
• Consider two finite-energy sequences x[n] • Thus
and y[n] a 2rxx [0] � 2a rxy [�] � ryy [0] � 0
• The energy of the combined sequence where rxx [0] � Ex � 0 and ryy [0] � E y � 0
a x[n] � y[n � �] is also finite and
• We can rewrite the equation on the previous
nonnegative, i.e., slide as
��n��� (a x[n] � y[n � �])2 � a 2 ��n��� x 2 [n]
�a 1��� rxx [�] rxy [0]�� ��1a �� � 0
r [0] r [�]
� 2a �� � 2
n � �� x[n] y[n � �] � �n � �� y [n � � ] � 0
� xy yy �
for any finite value of a
37 Copyright © 2005, S. K. Mitra 38 Copyright © 2005, S. K. Mitra
7
Correlation Computation Correlation Computation
Using MATLAB Using MATLAB
• The cross-correlation and autocorrelation • The cross-correlation sequence rxy [n]
sequences can easily be computed using computed using Program 2_7 of text is
MATLAB plotted below
• Example - Consider the two finite-length 30
sequences 20
x[n] � �1 3 � 2 1 2 � 1 4 4 2�
Amplitude
10
y[n] � �2 � 1 4 1 � 2 3� -10
-4 -2 0 2 4 6 8
Lag index
Amplitude
20
20
0
0
-20
-5 0 5 -20
Lag index -10 -5 0 5
45 Copyright © 2005, S. K. Mitra 46 Lag index
Copyright © 2005, S. K. Mitra
Correlation Computation
Correlation Computation
Using MATLAB
Using MATLAB
• The plot below shows the autocorrelation of
x[n] corrupted with an additive random • The autocorrelation and the cross-
noise generated using the function randn correlation can also be computed using the
function xcorr
• Note: The autocorrelation still exhibits a
peak at zero lag • However, the correlation sequences
80 generated using this function are the time-
60
reversed version of those generated using
Amplitude
40
Programs 2_7 and 2_8
20
0
-5 0 5
47 Lag index Copyright © 2005, S. K. Mitra 48 Copyright © 2005, S. K. Mitra
8
Normalized Forms of Correlation Computation for
Correlation
Power Signals
• Normalized forms of autocorrelation and
cross-correlation are given by • The cross-correlation sequence for a pair of
r [�] rxy [�] power signals, x[n] and y[n], is defined as
� xx [�] � xx , � xy [�] � 1 K
rxx [0] rxx [0]ryy [0] rxy [�] � lim � x[n] y[n � �]
K �� 2 K � 1 n � � K
• They are often used for convenience in
comparing and displaying • The autocorrelation sequence of a power
signal x[n] is given by
• Note: | � xx [�]| � 1 and | � xy [�]| � 1 K
independent of the range of values of x[n] 1
rxx [�] � lim � x[n]x[n � �]
and y[n] K �� 2 K � 1 n � � K
49 Copyright © 2005, S. K. Mitra 50 Copyright © 2005, S. K. Mitra
9
Correlation Computation for Correlation Computation for
Periodic Signals Periodic Signals
• The autocorrelation rdd [�] of d[n] will show
• In the last equation on the previous slide, rxx
~ ~ [� ]
a peak at � = 0 with other samples having
is a periodic sequence with a period N and rapidly decreasing amplitudes with
hence will have peaks at � � 0, N , 2 N , ... increasing values of |� |
with the same amplitudes as � approaches M
• Hence, peaks of rww[�] for � > 0 are
• As x~[n] and d[n] are not correlated, samples essentially due to the peaks of rxx
~ ~ [� ] and can
of cross-correlation sequences rxd
~ [� ] and rdx~ [� ]
be used to determine whether x~[n] is a
are likely to be very small relative to the periodic sequence and also its period N if
amplitudes of rxx~ ~ [� ]
the peaks occur at periodic intervals
55 Copyright © 2005, S. K. Mitra 56 Copyright © 2005, S. K. Mitra
Correlation Computation of a
Correlation Computation of a
Periodic Signal Using MATLAB
Periodic Signal Using MATLAB 60
40
Amplitude
sinusoidal sequence x[n] � cos(0.25n) ,
0
-20
amplitude in the range [�0.5, 0.5] • As can be seen from the plot given above,
• Using Program 2_8 of text we arrive at the there is a strong peak at zero lag
plot of rww[�] shown on the next slide • However, there are distinct peaks at lags that
are multiples of 8 indicating the period of the
sinusoidal sequence to be 8 as expected
57 Copyright © 2005, S. K. Mitra 58 Copyright © 2005, S. K. Mitra
Correlation Computation of a
Periodic Signal Using MATLAB
• Figure below shows the plot of rdd [�]
8
6
Amplitude
-2
-20 -10 0 10 20
Lag index
10