Digital Signal Processing Reference
In-Depth Information
(a) Signal = ones(1,32);
(b) Signal = ones(1,256);
(c) Signal = ones(1,2ˆ10);
13. Write the code to implement the script
function LVx_FF TDecnTimeAltCode(x,CmprMode,..
BitRCd,BtrFCd)
% x is the test signal; if not a power of 2 in length,
% it will be padded with zeros so that it is. Pass
% CmprMode as 0 to compare the time of execution
% for various user-written m-coded FF T's to the built-in
% fft; Pass CmprMode as 1 to compare the time of execution
% of a direct DF T to the built-in fft. When CmprMode is
% passed as 0, pass BitRCd as 0 to use a standard
% bit-reversal routine (from text) or as 1 to use direct
% decimation (user-written). Pass BtrFCd as 0 to run the
% butterfly routine from the text or as 1 to run a user-written
% butterfly routine. When CmprMode is passed as 1, you may
% pass BitRCd and BtrFCd as the empty matrix [].
% Test calls:
% LVx_FF TDecnTimeAltCode([0:1:31],1,[],[])
% LVx_FF TDecnTimeAltCode([0:1:1023],1,[],[])
% LVx_FF TDecnTimeAltCode([0:1:31],0,0,0)
% LVx_FF TDecnTimeAltCode([0:1:1023],0,0,0)
% LVx_FF TDecnTimeAltCode([0:1:31],0,1,0)
% LVx_FF TDecnTimeAltCode([0:1:1023],0,1,0)
% LVx_FF TDecnTimeAltCode([0:1:31],0,0,1)
% LVx_FF TDecnTimeAltCode([0:1:1023],0,0,1)
% LVx_FF TDecnTimeAltCode([0:1:31],0,1,1)
% LVx_FF TDecnTimeAltCode([0:1:1023],0,1,1)
The script described above has two general comparison modes. The first mode, specified by input
argument CmprMode = 1, compares the execution time and numerical result from the built-in FFT
(function ff t ) to the results from a direct DFT implementation written in m-code by yourself.
The second comparison mode, specified by input argument CmprMode = 1, compares execution
time and numerical result from the built-in FFT to results from an FFT routine written by you, in which
you specify by the input arguments how the decimation-in-time is performed, and how the butterfly
routine is performed.
The two decimation-in-time routines, selected by input argument BitRCd , consist of the efficient
bit-reversal code given in the text, and m-code written by yourself to repeatedly subdivide the sequences
into even and odd parts, as described in the text. You can probably reuse the code written for the previous
exercise to implement this portion of the current project.
The two butterfly routines, selected by BtrFCd , consist of the efficient butterfly code given in the
text, and m-code written by yourself that works in accordance with Eqs. (3.18) and (3.19).
Test the completed script by performing the FFT on the sequences below, and compare (using
the sum of differences method mentioned in the previous exercise) the result to that obtained using the
function ff t . Use the tic and toc functions in the script to determine the execution time for the built-in
FFT, the direct DFT, the two decimation-in-time routines, and the two butterfly routines. For each
Search WWH ::




Custom Search