
COMPUTATIONAL COST OF CHIRP Z-TRANSFORM AND GENERALIZED GOERTZEL ALGORITHM Pavel Rajmic Zdenek Prusa Christoph Wiesmeyr† Dept. of Telecommunications, FEEC, Brno University of Technology, Technicka´ 12, 616 00 Brno, Czech Republic, [email protected] Acoustics Research Institute, Austrian Academy of Sciences, Wohllebengasse 12–14, 1040 Wien, Austria, [email protected] † Numerical Harmonic Analysis Group, Faculty of Mathematics, University of Vienna Oskar-Morgenstern-Platz 1, 1090 Wien, Austria, [email protected] ABSTRACT such as the pruned-FFT [3, 4] can be applied to reduce the Two natural competitors in the area of narrow-band spectrum computational cost, but their performance, roughly speaking, analysis, namely the Chirp Z-transform (CZT) and the Gen- heavily depends on the divisibility properties of the number eralized Goertzel algorithm (GGA), are taken and compared, of frequency bins and the signal length. As a second option with the focus on the computational cost. We present results we mention the Zoom-FFT [5]. As presented in [6], this algo- showing that for real-input data, the GGA is preferable over rithm requires a number of steps including modulation, low- the CZT in a range of practical situations. This is shown both pass filtering and decimation, which make the algorithm more in theory and in practice. costly than both the CZT and the GGA. The goal of this paper is to analyze the complexities of Index Terms — Generalized Goertzel Algorithm, Chirp the CZT and the GGA and find conditions under which one is Z-transform, spectrum analysis, computational complexity, preferable to the other. Throughout the rest of this contribu- comparison, speed tion we assume only real input signals. In Sections 2 and 3 we briefly review the two algorithms. 1. INTRODUCTION The theoretical comparison is done in Sec. 4.1, while in Sec. 4.2 we present numerical experiments. Some other aspects A signal processing engineer is often interested in computing are then treated in Sec. 4.3. the spectrum of a small band of interest at a fine resolution. This applies both to amplitude (more often) and phase. The 2. GENERALIZED GOERTZEL ALGORITHM standard FFT provides too coarse spectral information and is global. The original algorithm invented by G. Goertzel [7], in the fol- The Chirp Z-transform algorithm [1] (CZT) is a well- lowing abbreviated to GA, serves to compute the k-th single established and widely used method for this type of spectral DFT entry for the signal {x[n]} of length N, i.e. analysis. The Generalized Goertzel Algorithm [2] (GGA) can be utilized as well, since the generalization allows for N−1 −j2πk n arbitrary, non-integer frequency indexes, in contrast to the X[k]= x[n]e N ,k=0,...,N − 1. (1) standard Goertzel algorithm (and the DFT). Since the GGA n=0 has been introduced only recently, the respective computa- This equation can, of course, be used directly for obtaining tional costs have not been compared in the literature yet. the DFT values, but the GA is advantageous because it re- Of course, there are other methods of obtaining the de- quires a quarter less computations [8]. Multiplying the right sired spectral samples: First, we can simply zero-pad the sig- j2πk N side of equation (1) by 1=e N leads to its equivalent, nal and run a standard FFT on this new sequence to get a fine-resolved spectrum. However, with this approach the vast N−1 −j2πk n−N majority of computed coefficients are of no interest. Methods X[k]= x[n]e N , (2) n=0 This work was supported by projects CZ.1.05/2.1.00/03.0072, CZ.1.07/2.3.00/20.0094 and CZ.1.07/2.2.00/28.0062 co-financed by which could be regarded as a convolution. Standard signal the European Social Fund and the state budget of the Czech Republic, and partly supported by the Austrian Science Fund (FWF) START-project processing literature then helps to rewrite this as an second- FLAME Y 551-N13, as well as FWF NFN S106 grant SISE. order IIR system. Denoting its state variables by s, the desired spectral sample X[k] is found as the output of such a system Input: frequency “index” k ∈ R; signal x of length N at time N: Output: y, representing X(ωk) according to eq. (5) %Precalculation of constants 2πk −j 2πk (N−1) −j N k −jA N X[k]=s[N] − e s[N − 1]. (3) A =2π N , B =2cosA, C =e , D =e %State variables It should be emphasized that the transition from (1) to (2) s0 =0, s1 =0, s2 =0 k k ∈ R %Main loop holds for integer-valued only; in the case of , these for i =0:N − 2 %one iteration less than traditionally two formulas are generally no longer in agreement. In fact, s0 = x[i]+B · s1 − s2 when k is not integer-valued, we should speak of the Discrete- s2 = s1 time Fourier transform (DTFT), defined by s1 = s0 end ∞ %Finalizing calculations s0 = x[N − 1] + B · s1 − s2 X(ω)= x[n]e−jωn,ω∈ R. (4) y = s0 − s1 · C n=−∞ y = y · D %constant substituting the iteration N − 1, and correcting the phase at the same time k With the notation ωk =2π N , k ∈ R, we can write that Fig. 1. Generalized Goertzel algorithm with shortened itera- N−1 −j2πk n tion loop. The changes, compared to the standard Goertzel X ω x n N , ( k)= [ ]e (5) algorithm, are marked in color. n=0 where we exploited the compactness of the support of the sig- spectral frequencies, which are linearly spread over a partic- {x n } nal [ ] . ular range. Formally, we are interested in K spectral samples The generalized Goertzel algorithm (GGA) [2] is applica- ωk = ω0 + kΔω, k =0,...,K− 1, i.e. ble for any k ∈ R: First, (5) is extended by unity in the form j2πk N −j2πk N N−1 of e N · e N =1for k ∈ R, leading to −j(ω0+kΔω)n X(ωk)= x[n]e . (8) N−1 n=0 −j2πk j2πk N−n X ω x n N . ( k)=e [ ]e (6) W −jΔω n=0 Substituting =e and using a trick due to Bluestein [11] yields Now with the same techniques as in the standard case we ar- N−1 2 2 2 k −jω n n − (k−n) rive at the DTFT coefficient in the form of X ω W 2 x n 0 W 2 W 2 ( k)= [ ]e (9) −j 2πk −j2πk n=0 X(ωk)= s[N] − e N s[N − 1] · e . (7) for k =0,...,K−1, which can be treated as the convolution 2 2 −jω n n − n Comparing this with the above, we indeed see that it is a gen- of two sequences, namely {x[n]e 0 W 2 } and {W 2 }, −j2πk eralization, since the constant e equals one for k ∈ Z.In k2 followed by multiplication by W 2 . The name of the trans- 2 fact, the only variation compared to the standard Goertzel al- − n {W 2 } gorithm is the multiplication by this constant at the very end form comes from the fact that the signal is usually of the algorithm. Clearly, e−j2πk affects only the phase of called a (linear) chirp. Padding these sequences to a proper length (power of two in common implementations) allows the X(ωk). We note that part of the community are aware of the possibility of using the standard GA also for k ∈ Z [6], but to computation of (9) via fast convolution, i.e. via multiplication the best of our knowledge, this is only performed in the con- in the spectral domain using FFT. The steps of the algorithm text of measuring the amplitude, which is clearly not affected, are detailed in Fig. 2. in contrast to the phase. It is shown in [2] that the algorithm (in fact, both the stan- 4. COMPARING GGA AND CZT dard and the generalized) can be further shortened by a few computations. The shortened GGA is summarized in Fig. 1. We first list a few basic, general facts about both algorithms The GGA has been recently exploited as a fine-scale and then focus on quantifying the computational complexity. spectrum analyzer for the detection of damages in cantilever • The GGA allows computations on the run, i.e. each time a beams [9]. single new sample is acquired, immediate updating of the state variables is possible. The CZT, on the other hand, can only start when all the samples have been received. 3. CHIRP Z-TRANSFORM ALGORITHM • While the signal length N is usually pushed to be a power The Chirp-Z transform, described well in a number of sources of two for maximum FFT performance, the complexity of [1, 8, 10], is a procedure used to compute a limited range of the GGA grows linearly in N (for K fixed). Input: starting frequency ω0 ∈ R; frequency step Δω; number of fre- This result can be obtained adopting the analysis from [13]. quencies K; signal x of length N; For K<Nit is possible to count the flops to NFFT = nextfftlength (N + K − 1) Output: Array y of K complex numbers representing X(ωk) according to Eq. (8) FCZT =4αN log2 K +(4α + 25)N − K (11) %Precalculation 2 Form sequence c[n]=W n /2 for n =0,...,K− 1 using a decimation/factorization scheme, under the assump- Form sequence d[n]=e−jω0nc[n] for n =0,...,N − 1 tion that K divides N and N is a power of 2.IfK and N do Form sequence of length NFFT: not fulfill these conditions, the computational cost increases.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages5 Page
-
File Size-