Hi everyone, I have been using a Goertzel algorithm to measure the power of 50 and 60 Hz tones in ADC data on a C6713 demo board. The technique is very succesful given a strong signal tone. Given a signficant tone, the measured power levels match precisely the input power and have a very low varying range (about 1dB). However, as the signal decreases, the variance of the measured power increases greatly. For example, with no significant signal in a noisy environment, the measured levels vary by about 40 dB with a 80 dB mean (numbers are arbitrary but useful for example). With a small signal, the variance decreases and the mean drops to 80 dB. As the desired signal in the noisy environment increases, the measured levels converge and match the changes in the input signal. Since I am trying to determine the existance and strength of the desired 50/60 Hz tone by simply its rise above the noise floor, the convergance to underneath the apparent (no signal) noise floor is frustrating and puzzling. I was wondering if anyone had any experience with this effect or had any suggestions to try. While I have had minimal luck with a moving average or windowed minema filter, the delay incurred is much larger than allowable. I have tried various forms of windowing on the input data, but the system still displays the same characteristics. The Geortzel algorithm is performed on a 4000 point data buffer with new data shifted in in 40 point segments. Thank you, Louis

# Goertzel Alogorithm Stability in Low SNR

Started by ●November 12, 2007

Reply by ●November 12, 20072007-11-12

On Nov 12, 8:37 am, "superlou" <lsim...@safeflight.com> wrote:> Hi everyone, > > I have been using a Goertzel algorithm to measure the power of 50 and 60 > Hz tones in ADC data on a C6713 demo board. The technique is very > succesful given a strong signal tone. Given a signficant tone, the > measured power levels match precisely the input power and have a very low > varying range (about 1dB). However, as the signal decreases, the variance > of the measured power increases greatly. For example, with no significant > signal in a noisy environment, the measured levels vary by about 40 dB > with a 80 dB mean (numbers are arbitrary but useful for example). With a > small signal, the variance decreases and the mean drops to 80 dB. As the > desired signal in the noisy environment increases, the measured levels > converge and match the changes in the input signal. > > Since I am trying to determine the existance and strength of the desired > 50/60 Hz tone by simply its rise above the noise floor, the convergance to > underneath the apparent (no signal) noise floor is frustrating and > puzzling. I was wondering if anyone had any experience with this effect > or had any suggestions to try. While I have had minimal luck with a > moving average or windowed minema filter, the delay incurred is much > larger than allowable. I have tried various forms of windowing on the > input data, but the system still displays the same characteristics. The > Geortzel algorithm is performed on a 4000 point data buffer with new data > shifted in in 40 point segments. > > Thank you, > LouisHello Louis, One thing you haven't mentioned is what is your sample rate? The standard Goertzel algo does poorly if you are trying to detect low (relative to the sample rate) frequencies. This is because the standard Goertzel algo uses a driven biquad oscillator, whose two memory elements tend to contain the same data for low frequencies. Instead you just drive a quadrature or a staggered quadrature oscillator (one that has a quadrature output in the limit of low frequency). This modified Goertzel will work quite a bit better at low frequencies than the standard Goertzel. I had posted this method several years back. Try looking here for details. http://groups.google.com/group/comp.dsp/browse_frm/thread/cee082125dc65685/41cf5b005db447c3?lnk=st&q=%2B%22comp.dsp%22+%2Bclay+%2Bgoertzel+%2Boscillator#41cf5b005db447c3 Clay

Reply by ●November 12, 20072007-11-12

On Mon, 12 Nov 2007 07:37:12 -0600, superlou wrote:> Hi everyone, > > I have been using a Goertzel algorithm to measure the power of 50 and 60 > > Hz tones in ADC data on a C6713 demo board. The technique is very > > succesful given a strong signal tone. Given a signficant tone, the > > measured power levels match precisely the input power and have a very low > > varying range (about 1dB). However, as the signal decreases, the variance > > of the measured power increases greatly. For example, with no significant > > signal in a noisy environment, the measured levels vary by about 40 dB > > with a 80 dB mean (numbers are arbitrary but useful for example).You are measuring variation in dB? Relative to what? This may be why you are seeing an apparent change in the noise 'variance' -- the term 'variance' is an absolute one, so your variance should be calculated in ADC counts, not dB relative to the signal or some such. The filter is a linear one, so with the same amount of noise you should always see the same absolute variance.> With a > > small signal, the variance decreases and the mean drops to 80 dB.Hold it. You just said with no signal the mean is 80dB. It changes from 80dB to 80dB? 80dB relative to what?> As the > > desired signal in the noisy environment increases, the measured levels > > converge and match the changes in the input signal.Certainly if you're expressing your output in dB this is what would appear to be the case; as the signal swamps out the noise the dB variation due to noise will, indeed, go down.> Since I am trying to determine the existance and strength of the desired > > 50/60 Hz tone by simply its rise above the noise floor, the convergance > to > > underneath the apparent (no signal) noise floor is frustrating and > > puzzling.This is the first time that you've mentioned the filter variance being less than the noise floor. Explain things thoroughly, please.> I was wondering if anyone had any experience with this effect > > or had any suggestions to try.How are you measuring noise? If you have broadband noise, then you would expect that a narrow filter such as you implement using the Goertzel algorithm would, indeed, have output "below the noise floor". It's why you're using the thing, for goodness sake! You should expect that in the presence of white noise, the noise output power of a narrow filter is the filter's bandwidth times the spectral power density of the noise.> While I have had minimal luck with a > > moving average or windowed minema filter, the delay incurred is much > > larger than allowable. I have tried various forms of windowing on the > > input data, but the system still displays the same characteristics. The > > Geortzel algorithm is performed on a 4000 point data buffer with new > data > > shifted in in 40 point segments. >It sounds like the algorithm is doing just as it should. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html

Reply by ●November 12, 20072007-11-12

Clay and Tim,>You are measuring variation in dB? Relative to what? This may be whyyou>are seeing an apparent change in the noise 'variance' -- the term >'variance' is an absolute one, so your variance should be calculated in >ADC counts, not dB relative to the signal or some such. The filter is a >linear one, so with the same amount of noise you should always see the >same absolute variance. >I apologize for the vagueness of how I explained my problem and will start from the beginning. I am new to DSP (a little theoretical background from texts) and welcome any corrections to my terminology. I did not mean variance (stat. definition) but the range of the power signals in the time domain. The dB levels were obtained simply by taking the magnitude squared output of a Goertzel algorithm and finding 10*log10 of that value. My naive approach was to find the maximum value when no intentional 50/60 Hz signal was applied and refer to this as a noise floor. I would then measure any increase in the 50 or 60 Hz goertzel outputs compared to this noise floor to identify the magnitude of each 50/60 Hz signal.>> With a >> >> small signal, the variance decreases and the mean drops to 80 dB. > >Hold it. You just said with no signal the mean is 80dB. It changesfrom>80dB to 80dB? 80dB relative to what? >The "dB" values are only valid for comparing power changes over time as they are really only relative to the ADC values. With a signal generator, I verified that increasing an input 50 or 60 Hz by n dB resulted in an increase in the Goertzel's output by n dB.>> As the >> >> desired signal in the noisy environment increases, the measured levels >> >> converge and match the changes in the input signal. > >Certainly if you're expressing your output in dB this is what wouldappear>to be the case; as the signal swamps out the noise the dB variation dueto>noise will, indeed, go down. > >> Since I am trying to determine the existance and strength of thedesired>> >> 50/60 Hz tone by simply its rise above the noise floor, theconvergance>> to >> >> underneath the apparent (no signal) noise floor is frustrating and >> >> puzzling. > >This is the first time that you've mentioned the filter variance being >less than the noise floor. Explain things thoroughly, please. >Given a test case starting out with no applied 50 or 60 Hz signal, the Goertzel power outputs vary between 60 and 100 dB with a mean near 80 dB. Again, these dB are relative only to themselves. Using my earlier assumption that with no applied signal, the values at 50 and 60 Hz will be a result of ambient noise, I said that 100 dB would be the top of this noise floor. What suprised me is that when a 60 Hz signal was applied, the 60 hz power first converged to 80 dB (<100dB) before increasing with increases in applied 60 Hz power. From my limited noise analysis, I had thought that additive white noise would be a constant component of the power output. While the system is definitly identifying a 60 Hz signal at that 80 dB mark, by simple thresholding, I can't say it exists until it passes 100dB and this significantly detracts from the sensitivity of the device. I could identify it earlier by monitoring the system variance, but I was wondering if there is a way to eliminate this effect and avoid the overhead of the additional calculations.>> I was wondering if anyone had any experience with this effect >> >> or had any suggestions to try. > >How are you measuring noise? If you have broadband noise, then youwould>expect that a narrow filter such as you implement using the Goertzel >algorithm would, indeed, have output "below the noise floor". It's why >you're using the thing, for goodness sake! > >You should expect that in the presence of white noise, the noise output >power of a narrow filter is the filter's bandwidth times the spectralpower>density of the noise. > >> While I have had minimal luck with a >> >> moving average or windowed minema filter, the delay incurred is much >> >> larger than allowable. I have tried various forms of windowing on the >> >> input data, but the system still displays the same characteristics.The>> >> Geortzel algorithm is performed on a 4000 point data buffer with new >> data >> >> shifted in in 40 point segments. >> > >It sounds like the algorithm is doing just as it should. >While the implementation I have can currently detect 50 or 60 Hz signals, I would like to improve the sensitivity on the device. I believe that there is room for improvement since an analog bandpass filtering device is able to detect a 60 Hz signal of a lower power level in the same environment. My sampling rate is as low as I could get it via the available hardware, 4kHz. I have not been using decimation in order to avoid the delay required for acquiring/filtering samples. The goal requires a bandwidth of 1 Hz. Clay, thank you for the link and I'm working on digesting those posts.

Reply by ●November 12, 20072007-11-12

superlou wrote:> Clay and Tim, > >> You are measuring variation in dB? Relative to what? This may be why > you >> are seeing an apparent change in the noise 'variance' -- the term >> 'variance' is an absolute one, so your variance should be calculated in >> ADC counts, not dB relative to the signal or some such. The filter is a >> linear one, so with the same amount of noise you should always see the >> same absolute variance. >> > > I apologize for the vagueness of how I explained my problem and will start > from the beginning. I am new to DSP (a little theoretical background from > texts) and welcome any corrections to my terminology. > > I did not mean variance (stat. definition) but the range of the power > signals in the time domain. The dB levels were obtained simply by taking > the magnitude squared output of a Goertzel algorithm and finding 10*log10 > of that value. My naive approach was to find the maximum value when no > intentional 50/60 Hz signal was applied and refer to this as a noise > floor. I would then measure any increase in the 50 or 60 Hz goertzel > outputs compared to this noise floor to identify the magnitude of each > 50/60 Hz signal. > >>> With a >>> >>> small signal, the variance decreases and the mean drops to 80 dB. >> Hold it. You just said with no signal the mean is 80dB. It changes > from >> 80dB to 80dB? 80dB relative to what? >> > > The "dB" values are only valid for comparing power changes over time as > they are really only relative to the ADC values. With a signal generator, > I verified that increasing an input 50 or 60 Hz by n dB resulted in an > increase in the Goertzel's output by n dB. > >>> As the >>> >>> desired signal in the noisy environment increases, the measured levels >>> >>> converge and match the changes in the input signal. >> Certainly if you're expressing your output in dB this is what would > appear >> to be the case; as the signal swamps out the noise the dB variation due > to >> noise will, indeed, go down. >> >>> Since I am trying to determine the existance and strength of the > desired >>> 50/60 Hz tone by simply its rise above the noise floor, the > convergance >>> to >>> >>> underneath the apparent (no signal) noise floor is frustrating and >>> >>> puzzling. >> This is the first time that you've mentioned the filter variance being >> less than the noise floor. Explain things thoroughly, please. >> > > Given a test case starting out with no applied 50 or 60 Hz signal, the > Goertzel power outputs vary between 60 and 100 dB with a mean near 80 dB. > Again, these dB are relative only to themselves. Using my earlier > assumption that with no applied signal, the values at 50 and 60 Hz will be > a result of ambient noise, I said that 100 dB would be the top of this > noise floor. > > What suprised me is that when a 60 Hz signal was applied, the 60 hz power > first converged to 80 dB (<100dB) before increasing with increases in > applied 60 Hz power. From my limited noise analysis, I had thought that > additive white noise would be a constant component of the power output. > > While the system is definitly identifying a 60 Hz signal at that 80 dB > mark, by simple thresholding, I can't say it exists until it passes 100dB > and this significantly detracts from the sensitivity of the device. I > could identify it earlier by monitoring the system variance, but I was > wondering if there is a way to eliminate this effect and avoid the > overhead of the additional calculations. > >>> I was wondering if anyone had any experience with this effect >>> >>> or had any suggestions to try. >> How are you measuring noise? If you have broadband noise, then you > would >> expect that a narrow filter such as you implement using the Goertzel >> algorithm would, indeed, have output "below the noise floor". It's why >> you're using the thing, for goodness sake! >> >> You should expect that in the presence of white noise, the noise output >> power of a narrow filter is the filter's bandwidth times the spectral > power >> density of the noise. >> >>> While I have had minimal luck with a >>> >>> moving average or windowed minema filter, the delay incurred is much >>> >>> larger than allowable. I have tried various forms of windowing on the >>> >>> input data, but the system still displays the same characteristics. > The >>> Geortzel algorithm is performed on a 4000 point data buffer with new >>> data >>> >>> shifted in in 40 point segments. >>> >> It sounds like the algorithm is doing just as it should. >> > > While the implementation I have can currently detect 50 or 60 Hz signals, > I would like to improve the sensitivity on the device. I believe that > there is room for improvement since an analog bandpass filtering device is > able to detect a 60 Hz signal of a lower power level in the same > environment. My sampling rate is as low as I could get it via the > available hardware, 4kHz. I have not been using decimation in order to > avoid the delay required for acquiring/filtering samples. The goal > requires a bandwidth of 1 Hz. Clay, thank you for the link and I'm > working on digesting those posts.Check to see what you get from your filter with _no_ input, or with some very small input, or with some small initial value on the states. Ideally you should be able to set the two states to some value (set them both to the same one), run the filter for one cycle, and and see those values back. Intuition tells me that with 4000 points, you need data paths that are at least 12 bits wider than your ADC data path. Mathematical analysis would tell me more, but I'm not getting paid for this... -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html

Reply by ●November 14, 20072007-11-14

>Check to see what you get from your filter with _no_ input, or with some >very small input, or with some small initial value on the states. >Ideally you should be able to set the two states to some value (set them>both to the same one), run the filter for one cycle, and and see those >values back.After implementing one of the low-frequency algorithms to supplement the text-book goertzel I have been using, I have the following results and interpretations. Please let me know if they make sense: 1) Given a constant input of 0 and states (q1,q2) reset to 0, both output 0 "dB". Both q's always equal 0. This makes intuitive sense following the math of the algorithms. 2) Inputting a full scale 60Hz sine wave (16bit, values -32768 to +32767, synthesized in software) leads to an output of 156dB and 6dB at 60 and 50 Hz respectively. If the states are instead set at each run to start at 1 or 32767, the 50Hz value increases slightly to a max at 9dB while the 60Hz value stays exactly the same. Both goertzel implementations behave virtually indentically for output, although the states for the textbook goertzel are similar positive or negative values while the alternative goertzel has one positive and one negative. In the above two cases, the algorithms were only run for one cycle (well, multiple cycles, but all information was reset each time). Because my implementation is a sliding form and the real world will incur a random phase offset, I then tested using a synthasized 60Hz full scale wave and ran the algorithms over many cycles. I found: 1) Given a fullscale wave, the output at 60Hz was a constant at 156dB while the 50Hz output oscillated 0 and 12 dB. 2) Given a 1/2 fullscale wave, the output at 60Hz is a constant 150. This makes sense as I have reduced the wave amplitude by have and am observing a 6dB drop. The 50Hz power oscillates around -173 to -161. I have examined both wave forms to verify there is no clipping. In all situations the q values change largely (more so in case 1 than 2) but multiple combinations will result in the same power. If my understanding is correct, this change is due to the phase information but I only care about the magnitude. If it wasn't for the vast difference in the 50Hz and between (1) and (2), I would say it is behaving as I expect it. Since the only change is input amplitude, I think the cause may be overflowing a variable somewhere and I am stepping through now trying to track it down.>Intuition tells me that with 4000 points, you need data paths that are >at least 12 bits wider than your ADC data path. Mathematical analysis >would tell me more, but I'm not getting paid for this...I am gathering 16bit data and am using doubles (52-bit mantessa) as when I started the project, I experienced large quantization errors trying to perform a similar task using high order narrow bandpass IIR filters. Because the goertzel is an FFT in an IIR form to evaluate only the frequency of interest, I stuck with the double datatype. Since both forms of the goertzel algorithm perform almost identically, and the alternative algorithm is keyed to avoid quantization errors at low target frequencies, it also points against quantization errors. My analysis of the necessary data widths is very weak and I'm very interested in your rule of thumb saying I would need 12 bits wider than the ADC data path. Based on your response, did you choose 12 bits as it is the lowest power of 2 to be greater than 4000? If you know of any texts or have a moment to explain some of your intuition I would greatly appreciate it. Thank you, Louis

Reply by ●November 14, 20072007-11-14

superlou wrote:> ... a full scale 60Hz sine wave (16bit, values -32768 to +32767has a DC component because of the asymmetry. -32767 to +32767 avoids that. ... Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Reply by ●November 15, 20072007-11-15

>superlou wrote: > >> ... a full scale 60Hz sine wave (16bit, values -32768 to +32767 > >has a DC component because of the asymmetry. -32767 to +32767 avoidsthat.>I have modified the program to generate the wave over -32767 to 32767. The results seem the same, although I will examine this more and make sure the real-world signals I have don't have a DC bias. As far as predicting it's impact, I thought that in the frequency domain, the DC offset would create an impulse at 0 Hz and the narrow filter shouldn't react to it. When working with DSPs, will there be an effect? I have actually noticed a small DC offset of the signals I am sending to the ADC. I am going to try removing this DC offset by subtracting the mean from each set of data before passing it to the Goertzel algorithm. I apologize for posting that with zero input to the goertzel I receive 0 dB out. Given that the output before converting to dB is 0, I should have output -Inf and it is likely an issue with the Log10 function in that situation.

Reply by ●November 15, 20072007-11-15

On Nov 14, 3:59 pm, "superlou" <lsim...@safeflight.com> wrote:> >Check to see what you get from your filter with _no_ input, or with some > >very small input, or with some small initial value on the states. > >Ideally you should be able to set the two states to some value (set them > >both to the same one), run the filter for one cycle, and and see those > >values back. > > After implementing one of the low-frequency algorithms to supplement the > text-book goertzel I have been using, I have the following results and > interpretations. Please let me know if they make sense: > > 1) Given a constant input of 0 and states (q1,q2) reset to 0, both output > 0 "dB". Both q's always equal 0. This makes intuitive sense following > the math of the algorithms. > 2) Inputting a full scale 60Hz sine wave (16bit, values -32768 to +32767, > synthesized in software) leads to an output of 156dB and 6dB at 60 and 50 > Hz respectively. If the states are instead set at each run to start at 1 > or 32767, the 50Hz value increases slightly to a max at 9dB while the 60Hz > value stays exactly the same. Both goertzel implementations behave > virtually indentically for output, although the states for the textbook > goertzel are similar positive or negative values while the alternative > goertzel has one positive and one negative. > > In the above two cases, the algorithms were only run for one cycle (well, > multiple cycles, but all information was reset each time). Because my > implementation is a sliding form and the real world will incur a random > phase offset, I then tested using a synthasized 60Hz full scale wave and > ran the algorithms over many cycles. I found: > > 1) Given a fullscale wave, the output at 60Hz was a constant at 156dB > while the 50Hz output oscillated 0 and 12 dB. > > 2) Given a 1/2 fullscale wave, the output at 60Hz is a constant 150. This > makes sense as I have reduced the wave amplitude by have and am observing a > 6dB drop. The 50Hz power oscillates around -173 to -161. > > I have examined both wave forms to verify there is no clipping. In all > situations the q values change largely (more so in case 1 than 2) but > multiple combinations will result in the same power. If my understanding > is correct, this change is due to the phase information but I only care > about the magnitude. If it wasn't for the vast difference in the 50Hz and > between (1) and (2), I would say it is behaving as I expect it. Since the > only change is input amplitude, I think the cause may be overflowing a > variable somewhere and I am stepping through now trying to track it down. > > >Intuition tells me that with 4000 points, you need data paths that are > >at least 12 bits wider than your ADC data path. Mathematical analysis > >would tell me more, but I'm not getting paid for this... > > I am gathering 16bit data and am using doubles (52-bit mantessa) as when I > started the project, I experienced large quantization errors trying to > perform a similar task using high order narrow bandpass IIR filters. > Because the goertzel is an FFT in an IIR form to evaluate only the > frequency of interest, I stuck with the double datatype. > > Since both forms of the goertzel algorithm perform almost identically, and > the alternative algorithm is keyed to avoid quantization errors at low > target frequencies, it also points against quantization errors. > > My analysis of the necessary data widths is very weak and I'm very > interested in your rule of thumb saying I would need 12 bits wider than > the ADC data path. Based on your response, did you choose 12 bits as it > is the lowest power of 2 to be greater than 4000? If you know of any > texts or have a moment to explain some of your intuition I would greatly > appreciate it. > > Thank you, > LouisHello Louis, The gain for a Goertzel is the same as for a DFT (ignoring numerical issues). So if you are feeding an input whose frequency matches that of the Goertzel, then your output will by scaled up by N/2 (amplitude) or (N/2)^2 for energy, where N is the number of samples. I don't think you've told us how many samples you are feeding into the thing. So expect your output to be 32767*N/2 for the expected amplitude. Since you didn't give the number of samples, we can back calculate to see how many your have (if 156dB is amplitude) 156 = 10 log(32767*N/2) -> N = 2.4E11 samples if 156dB is your amplitude (if 156dB is energy) 156 = 20 log(32767*N/2) -> N = 3851 samples Are you using about 3850 samples? If so then your numbers seem about right. Why don't you let us know: sample rate, number of samples, amplitude of signal Then we can check to see if the algo's output makes sense. Clay

Reply by ●November 15, 20072007-11-15

>The gain for a Goertzel is the same as for a DFT (ignoring numerical >issues). So if you are feeding an input whose frequency matches that >of the Goertzel, then your output will by scaled up by N/2 (amplitude) >or (N/2)^2 for energy, where N is the number of samples. I don't think >you've told us how many samples you are feeding into the thing. > >So expect your output to be 32767*N/2 for the expected amplitude. > >Since you didn't give the number of samples, we can back calculate to >see how many your have > >(if 156dB is amplitude) >156 = 10 log(32767*N/2) -> N = 2.4E11 samples if 156dB is your >amplitude > > >(if 156dB is energy) >156 = 20 log(32767*N/2) -> N = 3851 samples > >Are you using about 3850 samples? If so then your numbers seem about >right. > >Why don't you let us know: sample rate, number of samples, amplitude >of signal > >Then we can check to see if the algo's output makes sense. > >ClayThe output of the Goertzel algorithm is in terms of amplitude squared, and so 10*log(output^2) = 20*log(output). If I had received 157dB output it would have indicated 4321 data points and the output I gave was simply truncated down. Altering the program to give me another two significant figure, I get 156.32dB which leads to 3996 points. Since I'm using a 4000 sample block of data for the Goertzel, this seems ok to me. The signal amplitude was 32767 (range [-32767 32767]) and the sampling rate is 4000Hz. In order to provide more than one energy reading per second, I am shifting in data from a 40 point input buffer and recalculating the energy after each shift in. The input buffer size in my testing has ranged from about 40 to 400 in order to free up processing time for filtering and other processing, but the goertzel output remains the same (just gets calculated less often). The interesting thing I am noticing is that when I run the algorithm with the 32767 ampl. wave, the 60Hz energy level is a constant output while another Goertzel algorithm with a target frequency at 50Hz is oscillating between 0 and 12 dB (with an occasional -112). When I run the exact same test with an input 1/2 the size (16382 ampl.), the 60Hz energy retreats to 150dB (expected 6.1 dB decrease for 1/2 peak to peak range) but the 50Hz energy is constant at -108dB (no oscillation). Decreasing the amplitude by another factor of 2 sees the 60Hz energy to 144dB and 50Hz energy to -114dB. It looks almost like something is saturating in the algorithm with the full scale wave, but all the data types are double and I have not had any luck finding it yet. Being fairly inexperience with DSP in general and the Goertzel algorithm in particular, I was wondering if anyone had run across a similar situation. Thanks, Louis