Digital Signal Processing Reference
In-Depth Information
where k is the Lag Index. If sequences A
are each eight samples in length, for example,
C would be computed for values of k between -7 and +7. Note that in the formula above, B
[
n
]
and B
[
n
]
[
n
+
k
]
is
[
]
defined as 0 when n + k is less than 0 or greater than N - 1. Note also that C
0
is the CZL.
Example 4.10.
Use Eq. (4.14) to compute the correlation sequence of the following sequences:
[
1 ,
1
]
and
[−
2 , 1 , 3
]
.
The valid index values for each sequence run from 0 to the length of the respective sequence, minus
1. We pick the shorter sequence length to set N = 2 and then determine the proper range of k as -1 to +2
(the range of k must include all values of k for which the sequences overlap by at least one sample). Then
we get
C
[−
1
]=
A
[
0
]
B
[−
1
]+
A
[
1
]
B
[
0
]=+
2
C
[
0
]=
A
[
0
]
B
[
0
]+
A
[
1
]
B
[
1
]=−
3
C
[
1
]=
A
[
0
]
B
[
1
]+
A
[
1
]
B
[
2
]=−
2
C
[
2
]=
A
[
0
]
B
[
2
]+
A
[
1
]
B
[
3
]=
3
Note that B [−
1
]
and B [
3
]
lie outside the valid index range (0 to N -1) and are defined as having
the value 0.
It should be noted that the computations above may be viewed as the multiplication and
summing of overlapping samples from the two sequences (or waveforms) when one waveform is held
in place and the other slides over the first from right to left, one sample at a time.
Example 4.11. Show graphically how the correlation sequence of two rectangular sequences is computed
according to Eq. (4.14).
Figure 4.10, plot (a) shows two sampled rectangles poised, just overlapping by one sample, to
compute the correlation sequence. The rightmost one will “slide” over the leftmost one, one sample at a
time, and the correlation value at each position is computed by multiplying all overlapping samples and
adding all products. In this example, the amplitudes of the two sequences have been chosen so that all
products are 1, making the arithmetic easy to do. Plot (b) shows the correlation sequence, plotted for Lag
-7, the first Lag index at which the two rectangles overlap. The LabVIEW VIs
DemoCorrelationRectangles.vi
DemoCorrelationSines.vi
and
DemoCorrelationSineCosine.vi
implement correlation, respectively, of two rectangles, two sines, and sine and cosine, on a step-by-step
basis, one sample at a time.
Search WWH ::




Custom Search