Digital Signal Processing Reference
In-Depth Information
we've seen earlier in the chapter, the FFT can efficiently compute long DFTs. The DFT/FFT method
is much more efficient than the simple vector or matrix methods for computing the DTFT that were
discussed earlier in the topic.
Example 3.34.
Compute and display the spectrum of the impulse response
[
1, zeros ( 1 , 6 ), 1
]
using the
DFT and a large number of samples of the DTFT.
The impulse response [1,0,0,0,0,0,0,1] has a spectrum with a number of nulls which are not
adequately shown by an eight-point DFT. Computing 1024 frequency samples of the DTFT gives a
more complete picture. This was achieved by padding the original impulse response with zeros to a
length of 1024 samples. When using the function ff t , however, you can simply specify the length of
DFT to perform, and MathScript performs the zero-padding automatically. Thus, the call
x = [1,0,0,0,0,0,0,1];y=fft(x,1024); plot(abs(y))
will compute and plot the magnitude of 1024 samples of the DTFT between normalized radian frequen-
cies0to2 π .
Figure 3.41 shows the difference. The DFT values are correct for the particular frequencies they
test, but the number of frequencies tested is far too small to detect the “fine” structure of the actual
frequency response. The script
LV DT F T UsingP addedF F T (F I RXf erF cn, F F T Length)
allows you to see the difference in spectra between a DFT having the same length as a desired impulse
response ( FIRXferFcn ), and FFTLength samples of the DTFT. The call used to generate Fig. 3.41 was
LVDTF TUsingPaddedFF T([1,0,0,0,0,0,0,1],1024)
Example 3.35. An easy way to compute the frequency response at a high number of frequencies is to
simply pad the input sequence with zeros and then compute the DFT of the resultant sequence.
The script
LVPaddedDFT Movie(ImpResp,LenDT FT,CompMode)
allows you to experiment by inputting a desired impulse response as ImpResp , and a desired DFT length,
as LenDTFT . In making the script call, pass CompMode as 1 for automatic computation of the next
sample, or 2 if you want to press any key to compute the next sample. The call used to generate Figs. 3.42
and 3.43 was
LVPaddedDF TMovie([1,0,0,0,0,0,0,1],128,1)
Figure 3.42 shows the computation for k = 1. The two upper plots show the sequence or impulse
response under test plotted from index numbers 0 to 7, with indices 0 and 7 being valued 1 and indices 1-6
being zero (indices 8-127 are padded with zeros to compute the 128-point DFT). The cosine and sine
correlators, one cycle, are also plotted, and the correlation value is plotted at index 1 in plot (c). Figure 3.43
shows the next correlation, at k = 2. Since the correlators are 128 samples long, k will run from 0 to 64
to cover all unique bins. The DFT of an 8-point real sequence would test five unique frequencies, i.e., k
Search WWH ::




Custom Search