Digital Signal Processing Reference
In-Depth Information
sequence of length 8, for example, we would do CZLs using cosine-sine correlators of frequencies 0, 1,
2, 3, and 4.
The analysis formulas are
N
−
1
R
[
k
]=
CZL
COS
[
k
]=
x
[
n
]
cos
[
2
πnk/N
]
(4.11)
n
=
0
x
I
[
k
]=
CZL
SIN
[
k
]=∓
[
n
]
sin
[
2
πnk/N
]
(4.12)
[
]
where
N
is the length of the correlating functions as well as the signal
x
n
,
n
is the sample index, which
runs from 0 to
N
1,and
k
represents the frequency index, which assumes values of 0,1,..
N/
2 for
N
even or 0,1,...(
N
-1)/2 if
N
is odd.
Equations (4.11) and (4.12) are usually called the Real DFT analysis formulas, and the variables
−
R
[
k
]
(or some recognizable variation thereof ) are usually described as the real and imaginary
parts of the (real) DFT.
The synthesis formula is
and
I
[
k
]
K
x
[
n
]=
(A
k
/N)
R
[
k
]
cos
[
2
πnk/N
]∓
I
[
k
]
sin
[
2
πnk/N
]
(4.13)
k
=
0
where
n
=0,1,…
N-1
and
K
=
N/
2 for
N
even, and
(N
−
1
)/
2 for
N
odd, and the constant
A
k
=1 if
k
=0or
N/
2, and
A
k
=2 otherwise.
in the synthesis formula must match the sign employed in the analysis formula. It is
standard in electrical engineering to use a negative sign for the sine-correlated (or imaginary) component
in the analysis stage.
Note that the reconstructed wave is built one sample at a time by summing the contributions from
each frequency for the one sample being computed. It is also possible, instead of computing one sample
of output at a time, to compute and accumulate the contribution to the output of each harmonic for all
N
samples.
A script (see exercises below) that utilizes the formulas and principles discussed above to analyze
and reconstruct (using both methods discussed immediately above) a sequence of length
N
is
The sign of
I
[
k
]
LV xFreqT est(T estSeqType,N,UserT estSig,dispFreq)
where the argument
TestSeqType
represents a test sequence consisting of cosine and sine waves having
particular frequencies, phases, and amplitudes (for a list of the possible parameter values, see the exercises
below),
N
is the desired sequence length,
UserTestSeq
is a user-entered test sequence which will be utilized
in the script when
TestSeqType
is passed as 7, and
dispFreq
is a particular test correlator frequency used to
create two plots showing, respectively, the test signal and the test cosine of frequency
dispFreq
, and the
test signal and the test sine of frequency
dispFreq
. Figure 4.7 shows, for the call
LVxFreqTest(5,32,[],1)
the plots of test signal versus the test correlator cosine having
dispFreq
= 1 at plot (a), and the test
correlator sine having
dispFreq
= 1 at plot (b).
Figure 4.8 plots the cosine-correlated and sine-correlated coefficients after all correlations have
been performed.