From: Richard Owlett on 23 Mar 2010 12:55 gretzteam wrote: > Hi, > 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. > > 1) Simple IIR 2nd order notch filter. I can center the notch at exactly > 2kHz. It gets trick when quantizing the coefficients but it seems doable to > get 60dB with 14 bits. The problem is that the notch has to be very narrow > to avoid huge ringing in the step response. > Is there a way to improve the step response here? > > 2) Use some kind of adaptive scheme to find out the 2kHz sine/cosine > component in the incoming signal and remove it. I wouldn't know where to > start with such an approach. Can anyone elaborate on what the time domain > response would be when compared to the simple notch? > > This is all real time. > > Thanks! I'm over 4 decades out of date, but I suspect that you have omitted specifications which might make you life simpler. Is your system: 1. linear? 2. time invariant? 3. passive? Do you need "real time" as opposed to "post processing"? What is relevant definition of "real time"? (Hint -- an analytical solution may be massively complex. reality *MAY* be simpler ;/ In other words - what is problem you set out to solve?
From: gretzteam on 23 Mar 2010 14:03 >The widest possible notch filter has a denominator of z^2, and will only >'ring' for two steps -- but it may be a bit too wide for you. You could >play with longer, narrower FIR notch filters, if you don't mind their >"FIR"-ness. > >Like Clay said -- multiple, lower-Q (wider) filters in cascade will >probably help. This would approach the performance of the >above-mentioned FIR notch, with all the attendant complications of using >an IIR filter. Ok am I completely missing something here? I'm playing with a 2nd order IIR notch filter in FDATOOL, and the wider the notch, the larger amplitude of the ringing. This is why I have to go to a very narrow notch (500Hz gives manageable ringing). Am I doing this wrong? >a1: The PLL can be made to be time varying easier than the Kalman can, >ditto with adaptive. > >a2: The PLL approach will probably be more complex than the IIR notch >approach, but if the code is more clear... I've been learning about the Goertzel algorithm, which seems to be a clever way to find the I and Q of a given tone. Would this be a good way to start and avoid having to go through adaptive filters and PLL? The output of the Goertzel 'filter' is basically the DFT output coefficient for that bin. It updates every N output, which can be a parameter. I got this stuff from 'Understanding Digital Signal Processing' by R. Lyons. Thanks!
From: Tim Wescott on 23 Mar 2010 14:17 gretzteam wrote: >> The widest possible notch filter has a denominator of z^2, and will only >> 'ring' for two steps -- but it may be a bit too wide for you. You could >> play with longer, narrower FIR notch filters, if you don't mind their >> "FIR"-ness. >> >> Like Clay said -- multiple, lower-Q (wider) filters in cascade will >> probably help. This would approach the performance of the >> above-mentioned FIR notch, with all the attendant complications of using >> an IIR filter. > > Ok am I completely missing something here? I'm playing with a 2nd order IIR > notch filter in FDATOOL, and the wider the notch, the larger amplitude of > the ringing. This is why I have to go to a very narrow notch (500Hz gives > manageable ringing). Am I doing this wrong? > No. That's to be expected. The step function has a certain amount of energy around the notch frequency, and when you take that out everything else rings around it. But Clay and I aren't saying you should reduce the Q of one filter, we're saying you should use multiple filters with reduced Q. The only way to reduce the energy in the ring is to reduce the width of the notch -- you do that either by increasing the Q of your single filter, or by cascading multiple filters. So reducing the Q _of one filter_ will increase the ring amplitude, and make the ringing die out quicker. Increasing it will do the opposite. Adding more lower Q filters should (I haven't tried it) both reduce the amplitude and the length of the ring. That can't be a bad thing. >> a1: The PLL can be made to be time varying easier than the Kalman can, >> ditto with adaptive. >> >> a2: The PLL approach will probably be more complex than the IIR notch >> approach, but if the code is more clear... > > I've been learning about the Goertzel algorithm, which seems to be a clever > way to find the I and Q of a given tone. Would this be a good way to start > and avoid having to go through adaptive filters and PLL? The output of the > Goertzel 'filter' is basically the DFT output coefficient for that bin. It > updates every N output, which can be a parameter. > I got this stuff from 'Understanding Digital Signal Processing' by R. > Lyons. 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
From: Clay on 23 Mar 2010 14:40 On Mar 23, 10:20 am, "gretzteam" <gretzteam(a)n_o_s_p_a_m.yahoo.com> wrote: > >The notch approach is simplest but instead of trying it with a single > >very high "q" 2nd order filter, just cascade several lower "q" 2nd > >order filters in series. > > >IHTH, > >Clay > > Hi, > Are you saying a few even narrower notch in series with slightly different > center frequency? > > Thanks! No since you know the frequency, design each notch to be at that exact frequency. But in the filter equation you have a "q" factor that determines the "narrowness" of the filter. Instead of one very narrow filter use several not as narrow filters. And of course connect them in cascade where the output of one filter becomes the input of the next. By increasing the filter order we are increasing the transient response thus shortening the ring down time. IHTH, Clay
From: gretzteam on 23 Mar 2010 18:25
>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). Thanks! |