Digital Signal Processing Reference
In-Depth Information
and
N
−
1
sin
(
2
πkn/N)
cos
(
2
πkn/N)
=
0
(4.3)
n
=
0
where
k
is an integer,
N
is the sequence length, and
n
= 0:1:
N
1. The latter equation expresses the
principle of orthogonality of equal integral-frequency sine and cosine waves, which is simply that their
correlation value over one period is zero. When cosines are used instead of sines, the relationship is
−
N
N
−
1
if
k
=[
0
,N/
2
]
cos
(
2
πkn/N)
cos
(
2
πkn/N)
=
N/
2
if
otherwise
n
=
0
4.3.2 CZL OF SINUSOID PAIRS, ARBITRARY FREQUENCIES
Consider the following sum
S
C
where
N
is the number of samples in the sequence,
n
is the sample index,
and
k
1
and
k
2
represent integer frequencies such as -3, 0,1, 2, etc.
N
−
1
S
C
=
cos
[
2
πk
1
n/N
]
cos
[
2
πk
2
n/N
]
(4.4)
n
=
0
yields
⎧
⎨
N/
2
if
[
k
1
=
k
2
] =[
0,
N/
2
]
S
C
=
N
if
[
k
1
=
k
2
]
=
[
0,
N/
2
]
(4.5)
⎩
k
1
=
0
if
k
2
• In the statements above, it should be noted that values for frequencies
k
1
,
k
2
should be understood
as being modulo
N
. That is to say, the statement (for example)
[
k
1
=
k
2
] =
0
as well as all similar statements, should be interpreted as
[
k
1
=
k
2
] =
0
±
mN
where
m
is any integer ...-2,1,0,1,2...or in plain language as “
k
1
is equal to
k
2
, but
k
1
(and
k
2
) are not
equal to 0 plus or minus any integral multiple of
N
.”
Example 4.5.
Compute the correlation (CZL) of two cosines of the following frequencies, having N =
16:
a)
[
1
,
1
]
;
b)
[
0
,
0
]
;
c)
[
8
,
8
]
;
d)
[
6
,
7
]
;
e)
[
1
,
17
]
;
f)
[
0
,
16
]
;
g)
[
8
,
40
]
;
h)
[
6
,
55
]
.
To make the computations easy, we provide a simple function:
function [CorC] = LVCorrCosinesZerothLag(k1,k2,N)
n = 0:1:N-1;
CorC = sum(cos(2*pi*n*k1/N).*cos(2*pi*n*k2/N));
and after making the appropriate calls, we get the following answers: