CORRELATION - Roma Tre...
Transcript of CORRELATION - Roma Tre...
![Page 1: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/1.jpg)
CORRELATION
![Page 2: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/2.jpg)
In today’s class…
Cross-Correlation
Concepts
Relation with Convolution
Examples
Auto-Correlation
![Page 3: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/3.jpg)
Correlation
Definition:
Correlation or “Co-Relation” is a measure of similarity/ relationship between two signals
If x[n] & y[n] are two discrete-time signals, then the correlation of x[n] with respect to y[n] is given as,
rxy [l] x[m] y[m l] m
where l is lag, indicating time-shift
![Page 4: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/4.jpg)
Applications of Correlation
There are applications where it is necessary to compare one reference signal with one or more signals to determine the similarity between the pair and to determine additional information based on the similarity
![Page 5: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/5.jpg)
For example, in digital communications, a set of data symbols are represented by a set of unique discrete-time sequences
If one of these sequence has been transmitted, the receiver has to determine which particular sequence has been received, by comparing the received signal with every member of possible sequences from the set
Similarly correlation can also be used to timing recovery purpose
Also used in CDMA receivers
![Page 6: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/6.jpg)
Computing Cross-Correlation
Cross-Correlation: Correlation between two different sequences
Matlab command xcorr() can be used for this purpose
x-corr x wrt y
rxy [l] x[m] y[m l] m
x-corr y wrt x
ryx [l] y[m] x[m l] m
rxy [l] x[m l] y[m] m
ryx [l] y[m l] x[m] m
rxy [l] ryx [l] …Commutative?
![Page 7: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/7.jpg)
y[n] is said to be shifted by l samples to the right with respect to the reference sequence x[n] for positive values of l, and shifted by l samples to the left for negative values of l
The ordering of the subscripts xy in the definition of rxy[l] specifies that x[n] is the reference sequence which remains fixed in time, while y[n] is being shifted with respect to x[n]
![Page 8: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/8.jpg)
Relationship b/w Conv. & Corr.
Mathematically, Convolution between x[n] & h[n] is given as
y[n] x[k ] h[n k ] k
Correlation of x[n] with h[n] is given as
r[n] x[k] h[k n] k
Only replaced variables l by n and m by k
![Page 9: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/9.jpg)
But if we “time-reversed” the second sequence of the Convolution, we end up with Correlation
y[n] x[k ] h[(n k )] k
x[k ] h[n k ] k
r[n] x[k ] h[k n] k
Where, r[n] is the correlation of x[n] with respect to h[n]
![Page 10: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/10.jpg)
So, we can say that
“Correlation, mathematically, is just Convolution, with the second sequence, time-reversed”
r[n] x[n]* h[n]
We can use this property to find Correlation, using the
same method we used for Convolution, albeit, the second sequence needs to be time-reversed
time-reverse for This only requires that we don’t convolution in the first place!
![Page 11: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/11.jpg)
Example 1: Find the correlation b/w the two sequences x[n] and y[n] given by,
x[n] = [3 1 2] y[n] = [3 2 1]
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]: 3 2 1
y[m-1]: 3 2 1
y[m-2]: 3 2 1
y[m-3]: 3 2 1
Hint: The value of m starts from (– length of y + 1) and continues till (length of y + length of x – 1)
Here m starts from -3 + 1 = -2 and continues till 3 + 3 – 1 = 5
![Page 12: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/12.jpg)
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]: 3 2 1
y[m+1]:
3
2
1
y[m]: 3 2 1
y[m-1]: 3 2 1
y[m-2]: 3 2 1
y[m-3]: 3 2 1
rxy[-2] = 3 x 1 = 3
![Page 13: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/13.jpg)
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]:
3
2
1
y[m-1]: 3 2 1
y[m-2]: 3 2 1
y[m-3]: 3 2 1
rxy[-2] = 3 x 1 = 3
rxy[-1] = 3 x 2 + 1 x 1 = 7
![Page 14: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/14.jpg)
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]: 3 2 1
y[m-1]:
3
2
1
y[m-2]: 3 2 1
y[m-3]: 3 2 1
rxy[-2] = 3 x 1 = 3
rxy[-1] = 3 x 2 + 1 x 1 = 7
rxy[0] = 3 x 3 + 1 x 2 + 2 x 1= 13
![Page 15: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/15.jpg)
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]: 3 2 1
y[m-1]: 3 2 1
y[m-2]:
3
2
1
y[m-3]: 3 2 1
rxy[-2] = 3 x 1 = 3
rxy[-1] = 3 x 2 + 1 x 1 = 7
rxy[0] = 3 x 3 + 1 x 2 + 2 x 1= 13
rxy[1] = 1 x 3 + 2 x 2 = 7
![Page 16: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/16.jpg)
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]: 3 2 1
y[m-1]: 3 2 1
y[m-2]: 3 2 1
y[m-3]:
3
2
1
rxy[-2] = 3 x 1 = 3
rxy[-1] = 3 x 2 + 1 x 1 = 7
rxy[0] = 3 x 3 + 1 x 2 + 2 x 1= 13
rxy[1] = 1 x 3 + 2 x 2 = 7
rxy[2] = 2 x 3 = 6
![Page 17: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/17.jpg)
Define x & y in Matlab and use command xcorr(x,y) to verify this answer
m: -2 -1 0 1 2 3 4 5
x[m]: 3 1 2
y[m+2]:
3
2
1
y[m+1]: 3 2 1
y[m]: 3 2 1
y[m-1]: 3 2 1
y[m-2]: 3 2 1
y[m-3]: 3 2 1
rxy[-2] = 3 x 1 = 3
rxy[-1] = 3 x 2 + 1 x 1 = 7
rxy[0] = 3 x 3 + 1 x 2 + 2 x 1= 13
rxy[1] = 1 x 3 + 2 x 2 = 7
rxy[2] = 2 x 3 = 6
7 13 7 6} l {3 rxy[3] = 0 (no overlap)
rxy
![Page 18: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/18.jpg)
Example 2: Find the correlation of y[n] with respect to x[n], with the sequences given by,
x[n] = [3 1 2] y[n] = [3 2 1]
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]: 3 1 2
x[m-1]: 3 1 2
x[m-2]: 3 1 2
x[m-3]: 3 1 2
Hint: The value of m starts from (– length of y + 1) and continues till (length of y + length of x – 1)
Here m starts from -3 + 1 = -2 and continues till 3 + 3 – 1 = 5
![Page 19: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/19.jpg)
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]: 3 1 2
x[m+1]:
3
1
2
x[m]: 3 1 2
x[m-1]: 3 1 2
x[m-2]: 3 1 2
x[m-3]: 3 1 2
ryx[-2] = 3 x 2 = 6
![Page 20: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/20.jpg)
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]:
3
1
2
x[m-1]: 3 1 2
x[m-2]: 3 1 2
x[m-3]: 3 1 2
ryx[-2] = 3 x 2 = 6
ryx[-1] = 3 x 1 + 2 x 2 = 7
![Page 21: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/21.jpg)
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]: 3 1 2
x[m-1]:
3
1
2
x[m-2]: 3 1 2
x[m-3]: 3 1 2
ryx[-2] = 3 x 2 = 6
ryx[-1] = 3 x 1 + 2 x 2 = 7
ryx[0] = 3 x 3 + 2 x 1 + 1 x 2= 13
![Page 22: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/22.jpg)
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]: 3 1 2
x[m-1]: 3 1 2
x[m-2]:
3
1
2
x[m-3]: 3 1 2
ryx[-2] = 3 x 2 = 6
ryx[-1] = 3 x 1 + 2 x 2 = 7
ryx[0] = 3 x 3 + 2 x 1 + 1 x 2= 13
ryx[1] = 2 x 3 + 1 x 1 = 7
![Page 23: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/23.jpg)
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]: 3 1 2
x[m-1]: 3 1 2
x[m-2]: 3 1 2
x[m-3]:
3
1
2
ryx[-2] = 3 x 2 = 6
ryx[-1] = 3 x 1 + 2 x 2 = 7
ryx[0] = 3 x 3 + 2 x 1 + 1 x 2= 13
ryx[1] = 2 x 3 + 1 x 1 = 7
ryx[2] = 1 x 3 = 3
![Page 24: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/24.jpg)
Define x & y in Matlab and use command xcorr(y,x) to verify this answer
m: -2 -1 0 1 2 3 4 5
y[m]: 3 2 1
x[m+2]:
3
1
2
x[m+1]: 3 1 2
x[m]: 3 1 2
x[m-1]: 3 1 2
x[m-2]: 3 1 2
x[m-3]: 3 1 2
ryx[-2] = 3 x 2 = 6
ryx[-1] = 3 x 1 + 2 x 2 = 7
ryx[0] = 3 x 3 + 2 x 1 + 1 x 2= 13
7 13 7 3}
ryx[1] = 2 x 3 + 1 x 1 = 7
ryx[2] = 1 x 3 = 3
ryx[3] = 0 (no overlap)
ryx l {6
![Page 25: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/25.jpg)
Example 2: Find the correlation of the two sequences x[n] and y[n] represented by,
x[n] = {1 2 3} y[n] = [0.5 1 2 1 0.5]
Verify Rxy [l] Ryx [l]
![Page 26: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/26.jpg)
Autocorrelation
Auto-Correlation: Correlation between the same sequence
Mathematically, it is given as,
l 0,1,2,... rxx [l] x[m]x[m l], m
xx
n
x[m]x[m] x [n] Ex r [0] 2
At zero(0) lag, it returns a maximum value and the energy of the signal
![Page 27: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/27.jpg)
Ambiguity in the Results!
7
2
4
15
Suppose, I have three sequences
a[n] =[1 2 3 4 3 2 1]; b[n] =[4 8 12 16 12 8 4]; c[n] =[8 8 8 8 8 8 8];
7
5
10
7 7.5
8
8.5 and I want to find the correlation
between a[n] & b[n] and also
a[n] & c[n]
i.e. rab & rac
![Page 28: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/28.jpg)
The results show that
1) Correlation between a[n] & b[n] has a maximum value of 176 at zero lag
2) Correlation between a[n] & c[n] has a maximum value of 128 at zero lag
-6 -4 4 6
50
100
150 X= 0
Y= 176
Correlation between a with respect to b
These results seem ambiguous
and misleading, since a[n] is
a tri-pulse and c[n] is simply a
constant, while b[n] is only a
scaled version of a[n]
-6 -4 -2 0 2 4 6
120
100
80
60
40
20
X= 0
Y= 128
-2 0 2
Correlation between a with respect to c
![Page 29: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/29.jpg)
Normalized Correlations
Normalized Correlation between x[n] and y[n]
xy rxx 0 ryy 0
rxy l l
Normalized Autocorrelation
xx rxx 0
l rxx l
![Page 30: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/30.jpg)
Normalize the input sequences
1 2 6 7
0
0.5
1
1.5 X= 4
Y= 1
Normalized sequence a
1.5 X= 4
3 4 5
Normalized sequence b
3
2.5
2
1.5
1
0.5
0
X= 0
Y= 2.75
Correlation between a with respect to b
1 2 6 7
0
0.5
1
Y= 1
1 2 3 4 5 6 7 0.5
1
1.5
X= 4
Y= 1
3 4 5
Normalized sequence c
-6 -4 -2 0 2 4 6
-6 -4 -2 0 2 4 6
0
1
2
3
4
X= 0
Y= 4
Correlation between a with respect to c
![Page 31: CORRELATION - Roma Tre Universityhost.uniroma3.it/.../sp4bme/documents/LectureCorrelation.pdf´Correlation, mathematically, is just Convolution, with the second sequence, time-reversed](https://reader030.fdocuments.in/reader030/viewer/2022040723/5e3261094e7ed24b4463e911/html5/thumbnails/31.jpg)
Normalize the input sequences and the correlation sequences
1 2 6 7
0
0.5
1
1.5
X= 4
Y= 1
Normalized sequence a
1.5 X= 4
3 4 5
Normalized sequence b
0.4
0.2
0.6
1
0.8
Normalized Correlation between a with respect to b
X= 0
Y= 1
1 2 6 7
0
0.5
1
Y= 1
1 2 3 4 5 6 7 0.5
1
1.5
X= 4
Y= 1
3 4 5
Normalized sequence c
-6 -4 -2 0 2 4 6
0
-0.2
-6 -4 -2 0 2 4 6 -0.2
0
0.2
0.4
1
0.8
0.6
X= 0
Y= 0.91168
Normalized Correlation between a with respect to c