Digital Signal Processing Reference
In-Depth Information
As a final example, we'll compute the complex sequence values for
e j 2 πnk/N
where n = [0,1,2,3], N = 4, and k = 2. This reduces to
cos (0:1:3) )
+
j sin (0:1:3) )
which yields zero for all the imaginary components and for the real components we get [1,-1,1,-1]. This
can be verified by making the call
cos(pi*(0:1:3)) + j*sin(pi*(0:1:3))
2.4.14 SPECIFIC FREQUENCY GENERATION
• For a given sequence length N , by choosing
W
= M exp (j 2 πk/N)
the power sequence
W n
n
M n ( cos ( 2 πnk/N)
=[
M exp (j 2 πk/N)
]
=
+
j sin ( 2 πnk/N))
(2.4)
will define a complex sinusoid having k cycles over N samples after each power n of W from0to N -1 has
been evaluated. Note that the complex exponential sequence grows or decays with each succeeding sample
according to the value of the magnitude M .If
|
M
|
= 1, the sequence has a constant, unity-amplitude;
|
|
|
|
if
M
< 1, the sequence decays, and if
M
> 1, the sequence grows in amplitude with each succeeding
sample.
function [seqCos,seqSin] = LVGenFreq(M,k,N)
% [seqCos,seqSin] = LVGenFreq(1,2,8)
n = [0:1:N-1]; arg = 2*pi*k/N;
mags = (M.ˆn); maxmags = max(mags);
W2n = mags.*exp(j*arg).ˆn;
seqCos = real(W2n); seqSin = imag(W2n);
figure(66); subplot(211); stem(seqCos);
subplot(212); stem(seqSin)
To illustrate use of the above script, we'll generate cosine and sine waves, having peak-to-peak am-
plitudes of 2 (i.e., amplitudes of unity), and having 7.5 cycles over 73 samples. A peak-to-peak amplitude
of 2 means a variation in amplitude from -1 to +1, and hence an amplitude of 1.0, i.e., in the following
call we set M =1.
[seqCos,seqSin] = LVGenFreq(1,7.5,73);
The result is shown in Fig. 2.13.
To illustrate the generation of a growing complex exponential, we'll generate a cosine, sine pair
having a frequency of 3 cycles over 240 samples, and which increases in amplitude by a factor of 1.5 per
cycle. Since there are 240/3 samples per cycle, we take the 80th root of 1.5 as M . Code that makes the
computation of M easier and more flexible would be
Search WWH ::




Custom Search