The Sliding DFT

The Sliding DFT

Eric Jacobsen and Richard Lyons The Sliding DFT he standard method well as review the process of fre- filter’s structure is readily available in for spectrum analysis quency-domain convolution to ac- the literature [5]-[7]. in digital signal pro- complish time-domain windowing. The z-domain transfer function of cessing (DSP) is the Finally, a modified sliding DFT struc- the Goertzel filter is discrete Fourier ture is proposed that provides im- transform (DFT), typically imple- proved computational efficiency. HzG () Tmented using a fast Fourier transform − −−jkN21π / = 1 ez (FFT) algorithm. However, there are −− 12−+cos( 2πkNz / ) 12 z applications that require spectrum Goertzel Algorithm analysis only over a subset of the N (2) center frequencies of an N-point DFT. The Goertzel algorithm, used in A popular, as well as efficient, tech- dual-tone multifrequency decoding with a single z-domain zero located at = − jkN2 π / nique for computing sparse DFT re- and phase-shift keying/frequency-shift ze and conjugate poles at = ± jkN2 π / sultsistheGoertzelalgorithmthat keying modem implementations, is ze as shown in Figure 2(a). = − jkN2 π / computes a single complex DFT spec- commonly used to compute DFT The pole/zero pair at ze can- tral bin value for every N input time spectra [1]-[4]. The algorithm is im- cels each other. The frequency magni- samples. This article describes a sliding plemented in the form of a second-or- tude response, provided in Figure DFT process whose spectral bin out- der infinite impulse response (IIR) 2(b), shows resonance centered at a π put rate is equal to the input data rate, filter as shown in Figure 1. This filter normalized frequency of 2 kN/ , cor- on a sample-by-sample basis, with the computes a single DFT output (the responding to a cyclic frequency ⋅ advantage that it requires fewer com- kth bin of an N-point DFT) defined kfs / NHz (where f s is the signal putations than the Goertzel algorithm by sample rate). for real-time spectral analysis. In appli- While the Goertzel algorithm is N −1 − π derived from the standard DFT equa- cations where a new DFT output spec- Xk()= ∑ xne ( ) jnkN2 / . tion, it’s important to realize that the trum is desired every sample, or every n=0 (1) few samples, the sliding DFT is filter’s frequency magnitude response computationally simpler than the tra- The filter’s yn()output is equal to is not the sin(xx )/( )-like response of a ditional radix-2 FFT. We’ll start our the DFT output frequency coeffi- single-bin DFT. The Goertzel filter is sliding DFT discussion by providing a cient, Xk(), at the time index nN= . a complex resonator having an infi- brief review of the Goertzel algorithm For emphasis, we remind the reader nite-length unit impulse response, = jnkN2 π / anduseitsbehaviorasayardstickto that the filter’s yn()output is not hn() e , and that’s why its evaluate the performance of the sliding equal to Xk()at any time index when magnitude response is so narrow. DFT technique. Following that, we nN≠ . The frequency-domain index The time-domain difference equa- will examine stability issues regarding k is an integer in the range tions for the Goertzel filter are the sliding DFT implementation as 01≤≤kN −. The derivation of this vn( )=−22 cos(π kN / ) vn ( 1 ) −−+ vn()()2 xn (3a) “DSP Tips and Tricks” introduces practical tips and tricks of design and imple- mentation of signal processing algorithms so that you may be able to incor- =−− jkN2 π / − porate them into your designs. We welcome readers who enjoy reading this yn() vn () e vn (1 ). (3b) column to submit their contributions. Please contact Associate Editor Rick Ly- ons at [email protected]. An advantage of the Goertzel filter in calculating an N-point Xk()DFT 74 IEEE SIGNAL PROCESSING MAGAZINE MARCH 2003 1053-5888/03/$17.00©2003IEEE bin is that (3a) is implemented N times while (3b), the feed forward path in Figure 1, need only be com- puted once after the arrival of the Nth input sample. Thus for real xn()the filter requires N + 2 real multiplies and 21N + real adds to compute an N-point Xk(). However, when mod- eling the Goertzel filter if the time in- dex begins at n = 0, the filter must process N + 1 time samples with xN()= 0 to compute Xk(). Now let’s look at the sliding DFT process. ▲ 1. IIR filter implementation of the Goertzel algorithm. Sliding DFT The sliding DFT (SDFT) algorithm performs an N-point DFT on time samples within a sliding-window as shown in Figure 3. In this example the SDFT initially computes the DFT of the N = 16 time samples in Figure 3(a). The time window is then ad- vanced one sample, as in Figure 3(b), and a new N-point DFT is calculated. The value of this process is that each ▲ 2. Goertzel filter: (a) z-domain pole/zero locations and (b) frequency magnitude re- new DFT is efficiently computed di- sponse. rectly from the results of the previous DFT. The incremental advance of the time window for each output compu- tation is what leads to the name slid- ing DFT or sliding-window DFT. The principle used for the SDFT is known as the DFT shifting theorem or the circular shift property [8]. It states that if the DFT of a windowed (finite-length) time-domain se- quence is Xk(), then the DFT of that sequence, circularly shifted by one π sample, is Xke() jkN2 / . Thus the spec- tral components of a shifted time se- quence are the original (unshifted) spectral components multiplied by π e jkN2 / , where k is the DFT bin of in- terest. We express this process by =−jkN2 π / Snkk() Sn (1 ) e −−+xn()() N xn (4) where Snk ()is the new spectral com- − ▲ ponent and Snk ()1 is the previous 3. Signal windowing for two 16-point DFTs: (a) data samples in the first computation spectral component. The subscript k and (b) second computation samples. MARCH 2003 IEEE SIGNAL PROCESSING MAGAZINE 75 reminds us that the spectra are those put samples, and M is less than z-domain transfer function for the kth associated with the kth DFT bin. log2 (N ),theslidingDFTcanbe bin of the sliding DFT filter is Equation (4), whose derivation is computationally superior to tradi- provided in the Appendix, reveals the tional FFT implementations even − −N = ()1 z Hz() π − . value of this process in computing when all N DFT outputs are required. SDFT 1 − ezjkN21/ (5) real-time spectra. We calculate Snk () Equation (4) leads to the sin- by phase shifting the previous gle-bin SDFT filter structure shown This complex filter has N zeros Sn()− 1 components, subtract the in Figure 4. k equally spaced around the z-domain’s xn()− N sample, and add the current The single-bin SDFT algorithm is unit circle, due to the N-delay comb xn()sample. Thus the SDFT requires implemented as an IIR filter with a filter, as well as a single pole canceling only one complex multiply and two comb filter followed by a complex π the zero at ze= jkN2 / . The SDFT fil- real adds per output sample. The com- resonator [9]. (If you want to com- ter’s complex unit impulse response putational complexity of each succes- pute all N DFT spectral components, hn()and pole/zero locations are sive N-point output is then O(N ) for N resonators with k = 0 to N − 1 will 2 shown in Figure 5 for the example the sliding DFT compared to O(N ) be needed, all driven by a single comb where k = 2 and N = 20. for the DFT and O[NN log ( )] for filter.) The comb filter delay of N 2 Because of the comb subfilter, the the FFT. Unlike the DFT or FFT, samples forces the filter’s transient re- SDFT filter’s complex sinusoidal unit however, due to its recursive nature sponse to be N − 1samples in length, impulse response is finite in length, the sliding DFT output must be com- so the output will not reach steady truncated in time to N samples, and puted for each new input sample. If a state until theSN()sample. In practi- k that property makes the frequency new N-point DFT output is required cal applications the algorithm can be magnitude response of the SDFT fil- only every N inputs, the sliding DFT initialized with zero input and zero 2 ter identical to the sin(Nx )/sin( x ) re- requires O(N ) computations and is output. The output will not be valid, sponse of a single DFT bin centered equivalent to the DFT. When output or equivalent to (1)’s Xk(), until N in- at a normalized frequency of 2πkN/ . computations are required every M in- put samples have been processed. The One of the attributes of the SDFT − is that once an Snk ()1 is obtained, the number of computations to calcu- xn() Snk() + + late Snk ()is fixed and independent of N. A computational workload com- − − parison between the Goertzel and z N z 1 SDFT filters is provided later in this article. Unlike the radix-2 FFT, the − Snk(1) SDFT’s N can be any positive integer giving us greater flexibility to tune the −1 jkN2/π e SDFT’s center frequency by defining integer k such that kNff=⋅/ , ▲ 4. Single-bin sliding DFT filter structure. i s when f i is a frequency of interest in hertz. In addition, the SDFT does not 1 require bit-reversal processing as does the FFT.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us