DSPRelated.com
Forums

Best way to remove a known frequency

Started by gretzteam March 23, 2010
gretzteam wrote:
>> The Goertzel filter is just a bandpass filter that you run for a finite >> amount of time. A notch filter is just your signal minus the output of >> a bandpass filter. So a scheme that uses a Goertzel filter to >> periodically measure amplitude and phase is _probably_ not going to work >> as well as a notch filter. >> >> Besides, there are better methods than Goertzel filters if you happen to >> be on a processor with oodles of resources compared to your problem, as >> is often the case these days. >> >> -- >> Tim Wescott >> Control system and signal processing consulting >> www.wescottdesign.com >> > > Hi, > Thanks for the comments on the Goertzel filter. I agree that even if I > could make that to work, I don't see how it could beat a simple notch > filter. > > I'm actually implementing this in straight hardware where power/area is a > concern. I would be interested in knowing if anything could better than the > Goertzel filter in this case (let's say I was trying to 'detect' this tone > instead of removing it).
The complexity of a Goertzel is pretty much exactly the same as the complexity of a unity-gain bandpass or a notch. I'd use that. If you can stand detecting harmonics of the tone, demodulate it with a 2kHz square wave. That'll catch 2kHz, 6kHz, 10kHz, etc., but multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! If you've got multipliers to spare, then demodulate it with a 2kHz sine wave (and cosine wave). That'll catch _just_ 2kHz, and give you lots of control over what you do with the result. (In fact, you could do this instead of a PLL or a notch filter). -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On Mar 23, 6:34&#4294967295;pm, Tim Wescott <t...@seemywebsite.now> wrote:
> gretzteam wrote: > >> The Goertzel filter is just a bandpass filter that you run for a finite > >> amount of time. &#4294967295;A notch filter is just your signal minus the output of > >> a bandpass filter. &#4294967295;So a scheme that uses a Goertzel filter to > >> periodically measure amplitude and phase is _probably_ not going to work > >> as well as a notch filter. > > >> Besides, there are better methods than Goertzel filters if you happen to > >> be on a processor with oodles of resources compared to your problem, as > >> is often the case these days. > > >> -- > >> Tim Wescott > >> Control system and signal processing consulting > >>www.wescottdesign.com > > > Hi, > > Thanks for the comments on the Goertzel filter. I agree that even if I > > could make that to work, I don't see how it could beat a simple notch > > filter. > > > I'm actually implementing this in straight hardware where power/area is a > > concern. I would be interested in knowing if anything could better than the > > Goertzel filter in this case (let's say I was trying to 'detect' this tone > > instead of removing it). > > The complexity of a Goertzel is pretty much exactly the same as the > complexity of a unity-gain bandpass or a notch. &#4294967295;I'd use that. > > If you can stand detecting harmonics of the tone, demodulate it with a > 2kHz square wave. &#4294967295;That'll catch 2kHz, 6kHz, 10kHz, etc., but > multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! > > If you've got multipliers to spare, then demodulate it with a 2kHz sine > wave (and cosine wave). &#4294967295;That'll catch _just_ 2kHz, and give you lots of > control over what you do with the result. &#4294967295;(In fact, you could do this > instead of a PLL or a notch filter). > > -- > Tim Wescott > Control system and signal processing consultingwww.wescottdesign.com- Hide quoted text - > > - Show quoted text -
Has the OP stated to what extent it is important to preserve the signal around 2 KHz or below it? Dirk
Dirk Bell wrote:
> On Mar 23, 6:34 pm, Tim Wescott <t...@seemywebsite.now> wrote: >> gretzteam wrote: >>>> The Goertzel filter is just a bandpass filter that you run for a finite >>>> amount of time. A notch filter is just your signal minus the output of >>>> a bandpass filter. So a scheme that uses a Goertzel filter to >>>> periodically measure amplitude and phase is _probably_ not going to work >>>> as well as a notch filter. >>>> Besides, there are better methods than Goertzel filters if you happen to >>>> be on a processor with oodles of resources compared to your problem, as >>>> is often the case these days. >>>> -- >>>> Tim Wescott >>>> Control system and signal processing consulting >>>> www.wescottdesign.com >>> Hi, >>> Thanks for the comments on the Goertzel filter. I agree that even if I >>> could make that to work, I don't see how it could beat a simple notch >>> filter. >>> I'm actually implementing this in straight hardware where power/area is a >>> concern. I would be interested in knowing if anything could better than the >>> Goertzel filter in this case (let's say I was trying to 'detect' this tone >>> instead of removing it). >> The complexity of a Goertzel is pretty much exactly the same as the >> complexity of a unity-gain bandpass or a notch. I'd use that. >> >> If you can stand detecting harmonics of the tone, demodulate it with a >> 2kHz square wave. That'll catch 2kHz, 6kHz, 10kHz, etc., but >> multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! >> >> If you've got multipliers to spare, then demodulate it with a 2kHz sine >> wave (and cosine wave). That'll catch _just_ 2kHz, and give you lots of >> control over what you do with the result. (In fact, you could do this >> instead of a PLL or a notch filter). >> >> -- >> Tim Wescott >> Control system and signal processing consultingwww.wescottdesign.com- Hide quoted text - >> >> - Show quoted text - > > Has the OP stated to what extent it is important to preserve the > signal around 2 KHz or below it?
Nope. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
gretzteam <gretzteam@n_o_s_p_a_m.yahoo.com> wrote:

> I'm having problem getting rid of a 2kHz sine wave from a digitized signal > at 128kHz. I do know the exact frequency of the 2kHz (I generate it in the > first place with a DDS), but the phase/amplitude are unknown (it goes > through DAC->ADC.
> Now, there seems to be two approach to do this, and I don't know > what would be best.
The best way is to stop generating it in the first place. You don't mention that, so I am suggesting it here. Maybe there is a reason to generate it, or maybe not... -- glen

glen herrmannsfeldt wrote:

> gretzteam <gretzteam@n_o_s_p_a_m.yahoo.com> wrote: > > >>I'm having problem getting rid of a 2kHz sine wave from a digitized signal >>at 128kHz. I do know the exact frequency of the 2kHz (I generate it in the >>first place with a DDS), but the phase/amplitude are unknown (it goes >>through DAC->ADC. > > > >>Now, there seems to be two approach to do this, and I don't know >>what would be best. > > > The best way is to stop generating it in the first place. > You don't mention that, so I am suggesting it here. Maybe there > is a reason to generate it, or maybe not...
The 2kHz is exact fraction of 128kHz by exact binary ratio of 64. So generating and using it is not a very good idea anyway. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky <nospam@nowhere.com> wrote:
(snip, I wrote)
 
>> The best way is to stop generating it in the first place. >> You don't mention that, so I am suggesting it here. Maybe there >> is a reason to generate it, or maybe not...
> The 2kHz is exact fraction of 128kHz by exact binary ratio of 64. So > generating and using it is not a very good idea anyway.
Yes. I was presuming that it was not intentional, but due to some other problem in the digital part of the design. Instead of filtering it out from the analog signal, don't generate it in the first place. Or maybe a digital filter before the DAC could also remove it. All the discussion so far is on filtering the analog signal. -- glen
On Mar 23, 7:14&#4294967295;pm, Dirk Bell <bellda2...@cox.net> wrote:
> On Mar 23, 6:34&#4294967295;pm, Tim Wescott <t...@seemywebsite.now> wrote: > > > > > > > gretzteam wrote: > > >> The Goertzel filter is just a bandpass filter that you run for a finite > > >> amount of time. &#4294967295;A notch filter is just your signal minus the output of > > >> a bandpass filter. &#4294967295;So a scheme that uses a Goertzel filter to > > >> periodically measure amplitude and phase is _probably_ not going to work > > >> as well as a notch filter. > > > >> Besides, there are better methods than Goertzel filters if you happen to > > >> be on a processor with oodles of resources compared to your problem, as > > >> is often the case these days. > > > >> -- > > >> Tim Wescott > > >> Control system and signal processing consulting > > >>www.wescottdesign.com > > > > Hi, > > > Thanks for the comments on the Goertzel filter. I agree that even if I > > > could make that to work, I don't see how it could beat a simple notch > > > filter. > > > > I'm actually implementing this in straight hardware where power/area is a > > > concern. I would be interested in knowing if anything could better than the > > > Goertzel filter in this case (let's say I was trying to 'detect' this tone > > > instead of removing it). > > > The complexity of a Goertzel is pretty much exactly the same as the > > complexity of a unity-gain bandpass or a notch. &#4294967295;I'd use that. > > > If you can stand detecting harmonics of the tone, demodulate it with a > > 2kHz square wave. &#4294967295;That'll catch 2kHz, 6kHz, 10kHz, etc., but > > multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! > > > If you've got multipliers to spare, then demodulate it with a 2kHz sine > > wave (and cosine wave). &#4294967295;That'll catch _just_ 2kHz, and give you lots of > > control over what you do with the result. &#4294967295;(In fact, you could do this > > instead of a PLL or a notch filter). > > > -- > > Tim Wescott > > Control system and signal processing consultingwww.wescottdesign.com-Hide quoted text - > > > - Show quoted text - > > Has the OP stated to what extent it is important to preserve the > signal around 2 KHz or below it? > > Dirk- Hide quoted text - > > - Show quoted text -
Makes a difference in the solution. Dirk
On Mar 23, 8:15&#4294967295;pm, Tim Wescott <t...@seemywebsite.now> wrote:
> Dirk Bell wrote: > > On Mar 23, 6:34 pm, Tim Wescott <t...@seemywebsite.now> wrote: > >> gretzteam wrote: > >>>> The Goertzel filter is just a bandpass filter that you run for a finite > >>>> amount of time. &#4294967295;A notch filter is just your signal minus the output of > >>>> a bandpass filter. &#4294967295;So a scheme that uses a Goertzel filter to > >>>> periodically measure amplitude and phase is _probably_ not going to work > >>>> as well as a notch filter. > >>>> Besides, there are better methods than Goertzel filters if you happen to > >>>> be on a processor with oodles of resources compared to your problem, as > >>>> is often the case these days. > >>>> -- > >>>> Tim Wescott > >>>> Control system and signal processing consulting > >>>>www.wescottdesign.com > >>> Hi, > >>> Thanks for the comments on the Goertzel filter. I agree that even if I > >>> could make that to work, I don't see how it could beat a simple notch > >>> filter. > >>> I'm actually implementing this in straight hardware where power/area is a > >>> concern. I would be interested in knowing if anything could better than the > >>> Goertzel filter in this case (let's say I was trying to 'detect' this tone > >>> instead of removing it). > >> The complexity of a Goertzel is pretty much exactly the same as the > >> complexity of a unity-gain bandpass or a notch. &#4294967295;I'd use that. > > >> If you can stand detecting harmonics of the tone, demodulate it with a > >> 2kHz square wave. &#4294967295;That'll catch 2kHz, 6kHz, 10kHz, etc., but > >> multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! > > >> If you've got multipliers to spare, then demodulate it with a 2kHz sine > >> wave (and cosine wave). &#4294967295;That'll catch _just_ 2kHz, and give you lots of > >> control over what you do with the result. &#4294967295;(In fact, you could do this > >> instead of a PLL or a notch filter). > > >> -- > >> Tim Wescott > >> Control system and signal processing consultingwww.wescottdesign.com-Hide quoted text - > > >> - Show quoted text - > > > Has the OP stated to what extent it is important to preserve the > > signal around 2 KHz or below it? > > Nope. > > -- > Tim Wescott > Control system and signal processing consultingwww.wescottdesign.com- Hide quoted text - > > - Show quoted text -
Makes a difference in the solution. Dirk
Dirk Bell wrote:
> On Mar 23, 8:15 pm, Tim Wescott <t...@seemywebsite.now> wrote: >> Dirk Bell wrote: >>> On Mar 23, 6:34 pm, Tim Wescott <t...@seemywebsite.now> wrote: >>>> gretzteam wrote: >>>>>> The Goertzel filter is just a bandpass filter that you run for a finite >>>>>> amount of time. A notch filter is just your signal minus the output of >>>>>> a bandpass filter. So a scheme that uses a Goertzel filter to >>>>>> periodically measure amplitude and phase is _probably_ not going to work >>>>>> as well as a notch filter. >>>>>> Besides, there are better methods than Goertzel filters if you happen to >>>>>> be on a processor with oodles of resources compared to your problem, as >>>>>> is often the case these days. >>>>>> -- >>>>>> Tim Wescott >>>>>> Control system and signal processing consulting >>>>>> www.wescottdesign.com >>>>> Hi, >>>>> Thanks for the comments on the Goertzel filter. I agree that even if I >>>>> could make that to work, I don't see how it could beat a simple notch >>>>> filter. >>>>> I'm actually implementing this in straight hardware where power/area is a >>>>> concern. I would be interested in knowing if anything could better than the >>>>> Goertzel filter in this case (let's say I was trying to 'detect' this tone >>>>> instead of removing it). >>>> The complexity of a Goertzel is pretty much exactly the same as the >>>> complexity of a unity-gain bandpass or a notch. I'd use that. >>>> If you can stand detecting harmonics of the tone, demodulate it with a >>>> 2kHz square wave. That'll catch 2kHz, 6kHz, 10kHz, etc., but >>>> multiplying by 1 or -1 and accumulating sure doesn't use up much circuitry! >>>> If you've got multipliers to spare, then demodulate it with a 2kHz sine >>>> wave (and cosine wave). That'll catch _just_ 2kHz, and give you lots of >>>> control over what you do with the result. (In fact, you could do this >>>> instead of a PLL or a notch filter). >>>> -- >>>> Tim Wescott >>>> Control system and signal processing consultingwww.wescottdesign.com-Hide quoted text - >>>> - Show quoted text - >>> Has the OP stated to what extent it is important to preserve the >>> signal around 2 KHz or below it? >> Nope. >> >> -- >> Tim Wescott >> Control system and signal processing consultingwww.wescottdesign.com- Hide quoted text - >> >> - Show quoted text - > > Makes a difference in the solution. > > Dirk >
True, but the way that he stated it made it sound like the 2kHz signal was there intentionally. Presumably keeping it out of there in the first place isn't a DSP issue. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Hi,
Ok here are some clarifications:

>> Has the OP stated to what extent it is important to preserve the >> signal around 2 KHz or below it? >> Makes a difference in the solution.
This is for a medical application. Basic signal flow is: DDS -> DAC -> Human body -> ADC -> Decimation -> Detect AND get rid of 2kHz.
>> The 2kHz is exact fraction of 128kHz by exact binary ratio of 64. So >> generating and using it is not a very good idea anyway.
It's actually close to 2kHz, not dead-on 2k. The main problem is that the notch filter, or any other solution, need to affect square pulses as little as possible. Hope this clarifies things a bit. Thanks!