Hello, I found various documents regarding the Goertzel Algorithm along with formulas, pseudocodes and Fortran implementations as a way for performing a faster and more accurate DFT in real-time on a small number of samples. However what I don't get is that I can't find any example for the IDFT of the Goertzel algorithm. What is the trick to get the inverse computation out of using Goertzel either 1st order or 2nd order? Is it as simple as with DFT where a sign inversion practically inverses the transform or is it more difficult to achieve? Otherwise while Goertzel is not limited to 2^N input number of samples the standard IDFT is so using IDFT on a Goertzel computed DFT would surely lead to errors,right? If anyone could explain to me more clearly and provide a way to do inverse Goertzel both 1st order and 2nd order.. Thanks.

# Goertzel Algorithm

Started by ●December 22, 2011

Reply by ●December 22, 20112011-12-22

On Thu, 22 Dec 2011 07:48:25 -0600, aredo3606gif wrote:> Hello, > > I found various documents regarding the Goertzel Algorithm along with > formulas, pseudocodes and Fortran implementations as a way for > performing a faster and more accurate DFT in real-time on a small number > of samples.Faster, yes. More accurate -- no; the errors tend to build up, so inaccuracies in the initial computations are going to be magnified at the end.> However what I don't get is that I can't find any example > for the IDFT of the Goertzel algorithm.Probably because it is a really odd thing to try. To get an inverse DFT you need _all_ the bins, from a _complete_ DFT. You could use the Goertzel structure as an oscillator, and you could probably get things working, but compared to the IFFT, it would be very inefficient.> What is the trick to get the > inverse computation out of using Goertzel either 1st order or 2nd order? > Is it as simple as with DFT where a sign inversion practically inverses > the transform or is it more difficult to achieve?It isn't that simple, no.> Otherwise while > Goertzel is not limited to 2^N input number of samples the standard IDFT > is so using IDFT on a Goertzel computed DFT would surely lead to > errors,right?You are confused. A discrete Fourier transform is not limited to 2^N samples in any way shape or form. The early popular versions of the fast Fourier transform (FFT) were, but modern algorithms handle any number of input samples. What would surely lead to errors is using one or two bins out of a larger transform, and trying to do an IFFT on just those.> If anyone could explain to me more clearly and provide a way to do > inverse Goertzel both 1st order and 2nd order.. Thanks.Yes -- don't do it, and learn some DSP theory so you know why. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Reply by ●December 22, 20112011-12-22

>On Thu, 22 Dec 2011 07:48:25 -0600, aredo3606gif wrote: > >> Hello, >> >> I found various documents regarding the Goertzel Algorithm along with >> formulas, pseudocodes and Fortran implementations as a way for >> performing a faster and more accurate DFT in real-time on a smallnumber>> of samples. > >Faster, yes. More accurate -- no; the errors tend to build up, so >inaccuracies in the initial computations are going to be magnified at the>end. > >> However what I don't get is that I can't find any example >> for the IDFT of the Goertzel algorithm. > >Probably because it is a really odd thing to try. To get an inverse DFT >you need _all_ the bins, from a _complete_ DFT. You could use the >Goertzel structure as an oscillator, and you could probably get things >working, but compared to the IFFT, it would be very inefficient. > >> What is the trick to get the >> inverse computation out of using Goertzel either 1st order or 2ndorder?>> Is it as simple as with DFT where a sign inversion practically inverses >> the transform or is it more difficult to achieve? > >It isn't that simple, no. > >> Otherwise while >> Goertzel is not limited to 2^N input number of samples the standardIDFT>> is so using IDFT on a Goertzel computed DFT would surely lead to >> errors,right? > >You are confused. A discrete Fourier transform is not limited to 2^N >samples in any way shape or form. The early popular versions of the fast>Fourier transform (FFT) were, but modern algorithms handle any number of >input samples. > >What would surely lead to errors is using one or two bins out of a larger>transform, and trying to do an IFFT on just those. > >> If anyone could explain to me more clearly and provide a way to do >> inverse Goertzel both 1st order and 2nd order.. Thanks. > >Yes -- don't do it, and learn some DSP theory so you know why. > >-- >My liberal friends think I'm a conservative kook. >My conservative friends think I'm a liberal kook. >Why am I not happy that they have found common ground? > >Tim Wescott, Communications, Control, Circuits & Software >http://www.wescottdesign.comSo the Goertzel Algorithm for forward DFT provided by Burrus in 1985, as found here in its Fortran version: http://cnx.org/content/m17369/latest/ would be a wrong choice based on what you told me? Doesn't that algorithm provide the same results as of regular DFT ?

Reply by ●December 22, 20112011-12-22

On Dec 22, 8:48�am, "aredo3606gif" <aredo3606gif@n_o_s_p_a_m.yahoo.com> wrote:> Hello, > > I found various documents regarding the Goertzel Algorithm along with > formulas, pseudocodes and Fortran implementations as a way for performing a > faster and more accurate DFT in real-time on a small number of samples. > However what I don't get is that I can't find any example for the IDFT of > the Goertzel algorithm. What is the trick to get the inverse computation > out of using Goertzel either 1st order or 2nd order? > Is it as simple as with DFT where a sign inversion practically inverses the > transform or is it more difficult to achieve? > Otherwise while Goertzel is not limited to 2^N input number of samples the > standard IDFT is so using IDFT on a Goertzel computed DFT would surely lead > to errors,right? > If anyone could explain to me more clearly and provide a way to do inverse > Goertzel both 1st order and 2nd order.. > Thanks.Nowadays, the Goetzel isn't faster on modern DSP's, in is slower in fact then a plain DFT, mainly because modern DSP's are optimized to perform FIR filter (a DFT is a FIR filter) very fast (using SIMD instructions, you can do two to four DFT points in one cycle with no latency, the goetzel equation screws up all the prefetching optimazations of the newer DSP's thus adding latency) I suppose you can use the Goertzel backwards to do an IDFT, the real signal input to the Geortzel yields the exact DFT output, but as you know that is complex (mag/phase), so you need a Goertzel that handles complex numbers to do a IDFT.

Reply by ●December 22, 20112011-12-22

On Thu, 22 Dec 2011 12:01:00 -0600, aredo3606gif wrote:>>On Thu, 22 Dec 2011 07:48:25 -0600, aredo3606gif wrote: >> >>> Hello, >>> >>> I found various documents regarding the Goertzel Algorithm along with >>> formulas, pseudocodes and Fortran implementations as a way for >>> performing a faster and more accurate DFT in real-time on a small > number >>> of samples. >> >>Faster, yes. More accurate -- no; the errors tend to build up, so >>inaccuracies in the initial computations are going to be magnified at >>the > >>end. >> >>> However what I don't get is that I can't find any example for the IDFT >>> of the Goertzel algorithm. >> >>Probably because it is a really odd thing to try. To get an inverse DFT >>you need _all_ the bins, from a _complete_ DFT. You could use the >>Goertzel structure as an oscillator, and you could probably get things >>working, but compared to the IFFT, it would be very inefficient. >> >>> What is the trick to get the >>> inverse computation out of using Goertzel either 1st order or 2nd > order? >>> Is it as simple as with DFT where a sign inversion practically >>> inverses the transform or is it more difficult to achieve? >> >>It isn't that simple, no. >> >>> Otherwise while >>> Goertzel is not limited to 2^N input number of samples the standard > IDFT >>> is so using IDFT on a Goertzel computed DFT would surely lead to >>> errors,right? >> >>You are confused. A discrete Fourier transform is not limited to 2^N >>samples in any way shape or form. The early popular versions of the >>fast > >>Fourier transform (FFT) were, but modern algorithms handle any number of >>input samples. >> >>What would surely lead to errors is using one or two bins out of a >>larger > >>transform, and trying to do an IFFT on just those. >> >>> If anyone could explain to me more clearly and provide a way to do >>> inverse Goertzel both 1st order and 2nd order.. Thanks. >> >>Yes -- don't do it, and learn some DSP theory so you know why. > > So the Goertzel Algorithm for forward DFT provided by Burrus in 1985, as > found here in its Fortran version: > > http://cnx.org/content/m17369/latest/ > > would be a wrong choice based on what you told me? > > Doesn't that algorithm provide the same results as of regular DFT ?A wrong choice for what? Doing an inverse DFT? Yes. The Goertzel algorithm, _in theory_ provides the same results as _one bin_ of a regular DFT. If you want to do a complete N-point DFT using Goertzel, you need to have N Goertzel filters running, and you need to run them over N points. So you need to do something like 3 * N^2 multiply/adds, and because the Goertzel tends to propagate errors, they need to be of higher precision than otherwise. An FFT will do a complete N-point DFT in something like k * N * log(N), where k depends on the cleverness of the programmer and whether N is prime or easily factorable (and N = 2^n is _really_ easily factorable). I couldn't quote k values at you -- but I wouldn't try to implement a complete DFT using a Goertzel under any circumstances. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Reply by ●December 22, 20112011-12-22

>On Thu, 22 Dec 2011 12:01:00 -0600, aredo3606gif wrote: > >>>On Thu, 22 Dec 2011 07:48:25 -0600, aredo3606gif wrote: >>> >>>> Hello, >>>> >>>> I found various documents regarding the Goertzel Algorithm along with >>>> formulas, pseudocodes and Fortran implementations as a way for >>>> performing a faster and more accurate DFT in real-time on a small >> number >>>> of samples. >>> >>>Faster, yes. More accurate -- no; the errors tend to build up, so >>>inaccuracies in the initial computations are going to be magnified at >>>the >> >>>end. >>> >>>> However what I don't get is that I can't find any example for theIDFT>>>> of the Goertzel algorithm. >>> >>>Probably because it is a really odd thing to try. To get an inverseDFT>>>you need _all_ the bins, from a _complete_ DFT. You could use the >>>Goertzel structure as an oscillator, and you could probably get things >>>working, but compared to the IFFT, it would be very inefficient. >>> >>>> What is the trick to get the >>>> inverse computation out of using Goertzel either 1st order or 2nd >> order? >>>> Is it as simple as with DFT where a sign inversion practically >>>> inverses the transform or is it more difficult to achieve? >>> >>>It isn't that simple, no. >>> >>>> Otherwise while >>>> Goertzel is not limited to 2^N input number of samples the standard >> IDFT >>>> is so using IDFT on a Goertzel computed DFT would surely lead to >>>> errors,right? >>> >>>You are confused. A discrete Fourier transform is not limited to 2^N >>>samples in any way shape or form. The early popular versions of the >>>fast >> >>>Fourier transform (FFT) were, but modern algorithms handle any numberof>>>input samples. >>> >>>What would surely lead to errors is using one or two bins out of a >>>larger >> >>>transform, and trying to do an IFFT on just those. >>> >>>> If anyone could explain to me more clearly and provide a way to do >>>> inverse Goertzel both 1st order and 2nd order.. Thanks. >>> >>>Yes -- don't do it, and learn some DSP theory so you know why. >> >> So the Goertzel Algorithm for forward DFT provided by Burrus in 1985,as>> found here in its Fortran version: >> >> http://cnx.org/content/m17369/latest/ >> >> would be a wrong choice based on what you told me? >> >> Doesn't that algorithm provide the same results as of regular DFT ? > >A wrong choice for what? Doing an inverse DFT? Yes. > >The Goertzel algorithm, _in theory_ provides the same results as _one >bin_ of a regular DFT. If you want to do a complete N-point DFT using >Goertzel, you need to have N Goertzel filters running, and you need to >run them over N points. So you need to do something like 3 * N^2 >multiply/adds, and because the Goertzel tends to propagate errors, they >need to be of higher precision than otherwise. > >An FFT will do a complete N-point DFT in something like k * N * log(N), >where k depends on the cleverness of the programmer and whether N is >prime or easily factorable (and N = 2^n is _really_ easily factorable). >I couldn't quote k values at you -- but I wouldn't try to implement a >complete DFT using a Goertzel under any circumstances. > >-- >My liberal friends think I'm a conservative kook. >My conservative friends think I'm a liberal kook. >Why am I not happy that they have found common ground? > >Tim Wescott, Communications, Control, Circuits & Software >http://www.wescottdesign.comSearching on the subject I found this document dated 2004 where researchers there implemented an improved recursive based DFT/IDFT algorithm based on Goertzel. Do you think it would be worth trying to implement their ideas in actual code or it's just not worth it in any way regardless? Their explanations seem to point out that it can be an efficient solution for DFT calculation: http://ebookbrowse.com/high-speed-area-efficient-recursive-dft-idft-architectures-pdf-d34636382 "High-Speed Area-Efficient Recursive DFT/IDFT Architectures Lan-Da Van and Chih-Chyau Yang Chip Implementation Center (CIC), National Applied Research Laboratories, No. 1, Prosperity Rd. 1, Science-Based Industrial Park, Hsinchu, Taiwan, R.O.C. E-mail: {ldvan, ccyang} @cic.org.tw ABSTRACT In this paper, we propose several high-speed area-efficient recursive discrete Fourier transform (DFT)/inverse DFT (IDFT) designs adopting the module-sharing and register-splitting schemes. The proposed core architecture achieves one multiplier reduction as well as less critical period and a saving of nearly half multiplications compared with the second-order and first-order recursive DFT structures, respectively. So as to reduce the number of computation cycles, based on the new core design, we develop the area-efficient parallel and folded recursive DFT/IDFT architectures. Moreover, due to the advantages of regular and modular structure, the resulting high-speed area-efficient recursive DFT/IDFT architectures are amenable to application-specific integrated circuit (ASIC) design. 1. Introduction The discrete Fourier transform (DFT) has been widely applied in the analysis and implementation of discrete-time signal processing [1] and communication systems such as dual tone multi-frequency (DTMF) application [2-3]. In many applications, the complex sequences in time-domain are expected to be frequency-domain signals via the DFT computation. Without loss of generality, the input data is assumed as complex-valued data. From existing research, there are possible four categories for the structures of DFT computations: 1) recursive-algorithm based architecture [1-6], 2) butterfly-based architecture [1, 7], 3) ROM operation based structure [8], and 4) multiplier-accumulator based structure. It is well known that the DFT architectures based on the recursive algorithm are more area-efficient than those realized by other approaches. Until now, the existing recursive algorithms for the orthogonal transform in the scope of DFT/DCT/DST (discrete Fourier/cosine/sine transform) involve the following: Goertzel algorithm [1-6, 9], C-S’s algorithm [10], Chebyshev polynomials [11], and Clenshaw’s recurrence formula (CRF) [12-13]. In [10-12], recursive expressions for the computation of the DCT-II that are suitable for VLSI implementation are presented. The recursive DCT-II architecture [11] is based on Chebyshev polynomials of the third kind while those in [12] are based on CRF. Recently, Kidambi [13] furnished recursive DCT-IV and DST-IV architectures, where this approach can be possible to develop recursive DFT architecture. Note that in [10-13], recursive algorithms are used to design recursive DCT/DST architectures rather than recursive DFT architecture. In [1, 6], the original second-order recursive DFT architecture derived from Goertzel algorithm has one redundant multiplier and thus we can reuse the same multiplier to save the redundant one. This area-reduction strategy is referred to as the module-sharing scheme. Thus, the modified recursive DFT architecture has lower area than the preceding one [1, 6]. Next, we apply register-splitting scheme [14] to speedup the area-efficient architecture without affecting the system transfer function. Therefore, the proposed architecture possesses the following features: high speed, reduction of one multiplier compared with the second-order recursive DFT structure, and a saving of nearly half multiplications for each DFT output compared with the first-order recursive DFT structure. Regarding the new area-efficient recursive DFT/IDFT architecture as a core, we can develop parallel- and folded-type architectures to achieve less computation cycles for real-time media applications. The paper is organized as follows. A review of the first- and second-order recursive DFT structures is given in Section 2. In Section 3, we propose three new recursive DFT/IDFT architectures by module-sharing and register-splitting schemes: core-, parallel-, and folded-type architectures. In Section 4, comparison results are tabulated in terms of the critical period, the number of real multipliers, the amount of real multiplications as well as real additions for each DFT/IDFT output sequence, and the number of computation cycles for N-point DFT/IDFT. At last, the concise statements conclude this paper. " "The second-order recursive DFT structure can decrease the number of multiplications by Goertzel algorithm; however, the amount of multipliers and the value of the critical period are sacrificed. Hence, the structures in Figs. 1(a) and 2 are not efficient." "5. Conclusion We have devised three new recursive DFT/IDFT architectures based on Goertzel algorithm by the hybrid of module-sharing and register-splitting schemes. The module-sharing scheme can highly reduce the number of multipliers. On the other hand, register-splitting scheme results in a high-speed architecture. Based on Goertzel algorithm, we retain the characteristic of low operations for DFT/IDFT designs."

Reply by ●December 22, 20112011-12-22

>Hello, > >I found various documents regarding the Goertzel Algorithm along with >formulas, pseudocodes and Fortran implementations as a way for performinga>faster and more accurate DFT in real-time on a small number of samples. >However what I don't get is that I can't find any example for the IDFT of >the Goertzel algorithm. What is the trick to get the inverse computation >out of using Goertzel either 1st order or 2nd order? >Is it as simple as with DFT where a sign inversion practically inversesthe>transform or is it more difficult to achieve? >Otherwise while Goertzel is not limited to 2^N input number of samplesthe>standard IDFT is so using IDFT on a Goertzel computed DFT would surelylead>to errors,right? >If anyone could explain to me more clearly and provide a way to doinverse>Goertzel both 1st order and 2nd order.. >Thanks.Hi. Humm, what exactly is an 'inverse Geortzel' process. The output of a Goertzel operation is a single complex number, in the form of X = a+jb. Now given that a+jb sample, what is it you're trying to compute? I hope you're not trying to compute the input time samples that were used to compute the X = a+jb sample. [-Rick-]

Reply by ●December 22, 20112011-12-22

On Thu, 22 Dec 2011 16:01:52 -0600, aredo3606gif wrote:>>On Thu, 22 Dec 2011 12:01:00 -0600, aredo3606gif wrote: >> >>>>On Thu, 22 Dec 2011 07:48:25 -0600, aredo3606gif wrote: >>>> >>>>> Hello, >>>>> >>>>> I found various documents regarding the Goertzel Algorithm along >>>>> with formulas, pseudocodes and Fortran implementations as a way for >>>>> performing a faster and more accurate DFT in real-time on a small >>> number >>>>> of samples. >>>> >>>>Faster, yes. More accurate -- no; the errors tend to build up, so >>>>inaccuracies in the initial computations are going to be magnified at >>>>the >>> >>>>end. >>>> >>>>> However what I don't get is that I can't find any example for the > IDFT >>>>> of the Goertzel algorithm. >>>> >>>>Probably because it is a really odd thing to try. To get an inverse > DFT >>>>you need _all_ the bins, from a _complete_ DFT. You could use the >>>>Goertzel structure as an oscillator, and you could probably get things >>>>working, but compared to the IFFT, it would be very inefficient. >>>> >>>>> What is the trick to get the >>>>> inverse computation out of using Goertzel either 1st order or 2nd >>> order? >>>>> Is it as simple as with DFT where a sign inversion practically >>>>> inverses the transform or is it more difficult to achieve? >>>> >>>>It isn't that simple, no. >>>> >>>>> Otherwise while >>>>> Goertzel is not limited to 2^N input number of samples the standard >>> IDFT >>>>> is so using IDFT on a Goertzel computed DFT would surely lead to >>>>> errors,right? >>>> >>>>You are confused. A discrete Fourier transform is not limited to 2^N >>>>samples in any way shape or form. The early popular versions of the >>>>fast >>> >>>>Fourier transform (FFT) were, but modern algorithms handle any number > of >>>>input samples. >>>> >>>>What would surely lead to errors is using one or two bins out of a >>>>larger >>> >>>>transform, and trying to do an IFFT on just those. >>>> >>>>> If anyone could explain to me more clearly and provide a way to do >>>>> inverse Goertzel both 1st order and 2nd order.. Thanks. >>>> >>>>Yes -- don't do it, and learn some DSP theory so you know why. >>> >>> So the Goertzel Algorithm for forward DFT provided by Burrus in 1985, > as >>> found here in its Fortran version: >>> >>> http://cnx.org/content/m17369/latest/ >>> >>> would be a wrong choice based on what you told me? >>> >>> Doesn't that algorithm provide the same results as of regular DFT ? >> >>A wrong choice for what? Doing an inverse DFT? Yes. >> >>The Goertzel algorithm, _in theory_ provides the same results as _one >>bin_ of a regular DFT. If you want to do a complete N-point DFT using >>Goertzel, you need to have N Goertzel filters running, and you need to >>run them over N points. So you need to do something like 3 * N^2 >>multiply/adds, and because the Goertzel tends to propagate errors, they >>need to be of higher precision than otherwise. >> >>An FFT will do a complete N-point DFT in something like k * N * log(N), >>where k depends on the cleverness of the programmer and whether N is >>prime or easily factorable (and N = 2^n is _really_ easily factorable). >>I couldn't quote k values at you -- but I wouldn't try to implement a >>complete DFT using a Goertzel under any circumstances. >> >>-- >>My liberal friends think I'm a conservative kook. My conservative >>friends think I'm a liberal kook. Why am I not happy that they have >>found common ground? >> >>Tim Wescott, Communications, Control, Circuits & Software >>http://www.wescottdesign.com > > Searching on the subject I found this document dated 2004 where > researchers there implemented an improved recursive based DFT/IDFT > algorithm based on Goertzel. Do you think it would be worth trying to > implement their ideas in actual code or it's just not worth it in any > way regardless? Their explanations seem to point out that it can be an > efficient solution for DFT calculation: >What are you really trying to _do_? Just dink around with the Goertzel -- in that case, go have fun. Solve some specific problem? In that case, tell us, and we'll tell you what we think is the best solution. (Well, each of us will tell you what we think is the best solution, and then we'll fall to arguing amongst ourselves about why each of is right and everyone else is wrong. But you'll learn something). -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Reply by ●October 18, 20132013-10-18

I too was searching for an answer to this problem,(I too am learning DSP). I think u can find the idft using goertzel algorithm with the fact that time is reciprocal to frequency. so dft{dft{x(n)}}=dft{X(k)}=N*x(-n) N is the length of the dft sequence. so u actually find the dft of X(k) which is nothing but N*x(-n).

Reply by ●October 18, 20132013-10-18

On Fri, 18 Oct 2013 09:00:34 -0700, techsavyjoe wrote:> I too was searching for an answer to this problem,(I too am learning > DSP). > I think u can find the idft using goertzel algorithm with the fact that > time is reciprocal to frequency. > > so dft{dft{x(n)}}=dft{X(k)}=N*x(-n) > N is the length of the dft sequence. > > so u actually find the dft of X(k) which is nothing but N*x(-n).The Goertzel algorithm is, in my opinion, a honey trap set out to entrap beginners to DSP. It is a supposedly-efficient way of finding just one bin of the DFT. As such, it can come in handy when you need to separate out just one frequency component from a signal. If you need lots of frequency information then the fast Fourier transform is more efficient. If you want to trade off clarity in your software for storage space, then doing a multiply and accumulate reads much easier and assuming a pre- calculated sine table should actually take fewer clock ticks on modern processors, and many fewer clock ticks on a DSP with dedicated MAC hardware. Even assuming that you've got an environment where the Goertzel is more efficient, the IDFT isn't useful to do one bin at a time -- one "bin" of the IDFT is just the signal value at one particular delay, and you're generally interested in enough of them that it's far more efficient to do the whole thing using the fast Fourier transform algorithm. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com