Digital Signal Processing Reference
In-Depth Information
correlator, convolve
x
with the impulse response, then take the CZL as the DFT bin sought. Verify
the answer using the function fft.
[
n
]
Code that performs the above and checks the answer is as follows:
theBin = 2;x=randn(1,8); N = length(x);
fBin = exp(-j*2*pi*(0:1:N-1)*theBin/N);
cc = fliplr(fBin); y = conv(cc,x);
CZL = y(1,N), mftx = fft(x); fftBin = mftx(theBin+1)
Now imagine that instead of performing the convolution using an FIR, it is done using an IIR
having an impulse response that, over a finite number of samples, matches the complex correlator needed
If, for example, the bin sought is Bin
k
for a length-
N
DFT, we set
p = exp(j*2*pi*k/N)
Let's consider the case of a length-4 sequence for which we want to compute Bin 1. If the samples
of the sequence are designated
s
[
0
]
,
s
[
1
]
,
s
[
2
]
, and
s
[
3
]
, and we process the sequence with an IIR having
a single pole at
p = exp(j*2*pi*1/4)
then we can write the output values of the filter as
s[0]
p
1
s[0] + s[1]
p
2
s[0] + p
1
s[1] +s[2]
p
3
s[0] + p
2
s[1] +p
1
s[2] + s[3]
p
4
s[0] + p
3
s[1] +p
2
s[2] + p
1
s[3]
the last term of which, due to periodicity, is the same as
p
0
s[0] + p
−
1
s[1] +p
−
2
s[2] + p
−
3
s[3]
which is a correlation at the zeroth lag between the signal and the complex power sequence
exp(-
j*2*pi*1/4).ˆ(0:1:3)
which is the same complex power sequence used to compute DFT Bin 1 for a length-4 DFT.
Example 3.24.
Verify that, for the above example, that
p.
ˆ
(
4
:−
1
:
1
)
is the same as
p.
ˆ
(
0
:−
1
:−
3
)
.
We run the following code:
p = exp(j*2*pi*1/4); ans1 = p.ˆ(4:-1:1)
,
ans2 = p.ˆ(0:-1:-3)
which shows that the two expressions yield the same result.
Example 3.25.
Compute Bin 3 for the 8-pt DFT of the sequence
x
=
[−
3
:
1
:
4
]
using the Goertzel
algorithm and using the function
ff t
.
We run the code