DSPRelated.com
Forums

60Hz Notch filter at 25kHz sampling rate?

Started by abradley1984 August 28, 2008
Vladimir Vassilevsky wrote:
> > > abradley1984 wrote: > >> Hello, >> I have an ENG signal, sampled at 25kHz that has high mains interference >> that I want to remove. The problem is I need the surrounding >> frequencies, >> maybe not 50-70, but I can't afford to sacrifice much more than this. >> The >> filter designs I've been looking at don't seem to be able to do this at >> such a high sampling rate. >> Any suggestions? Would downsampling help? > > As mentioned by many, it is not a big deal to build the narrowband notch > at power frequency with or without downsampling. However if you are > dealing with the recorded signal (as opposed to the processing in the > real time) the better approach would be to estimate the parameters of > the interference and then subtract it from the signal. Assuming the > interference is stationary or slowly varying, this will allow canceling > it without making damage to the useful data.
If the data are recorded, maybe the OP can find iterative methods to suppress the noise. If they are being freshly acquired, she should do a better job of suppressing noise at the source. Shielding, breaking ground loops, and suppressing common mode can all be done together. Noise and mosquitoes have this in common: it is more satisfactory to keep them out than to mitigate their presence. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
>Hello, > >I have an ENG signal, sampled at 25kHz that has high mains interference >that I want to remove. The problem is I need the surrounding
frequencies,
>maybe not 50-70, but I can't afford to sacrifice much more than this.
The
>filter designs I've been looking at don't seem to be able to do this at >such a high sampling rate. > >Any suggestions? Would downsampling help? > >Thank you in advance for your help > >Allison > > >
Thank you all for your helpful advice, it's nice to hear from people who clearly know a lot more than me! I think my problem is that I'm being lazy, and trying to implement the filter straight in matlab using a butterworth filter. After listening to your advice I realised I need to think a bit more about IIR filters, so I went to Matlab help, which gave me this advice: "All classical IIR lowpass filters are ill-conditioned for extremely low cut-off frequencies. Therefore, instead of designing a lowpass IIR filter with a very narrow passband, it can be better to design a wider passband and decimate the input signal." Which I'm presuming means down sample? I can afford to down sample, so I think I should do that. I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm really only looking at frequencies up to 100Hz at the minute. And in case your interested, it's recorded data, interneural recordings, and I did my utmost to avoid noise during recording. So I'm going to try downsampling and see if that works, and if not I'll go back and study up on filter design and implementation. Thanks again for all your help! Allison
On Aug 29, 1:16&#4294967295;pm, "abradley1984" <abradley1...@gmail.com> wrote:
> >Hello, > > >I have an ENG signal, sampled at 25kHz that has high mains interference > >that I want to remove. &#4294967295;The problem is I need the surrounding > frequencies, > >maybe not 50-70, but I can't afford to sacrifice much more than this. > The > >filter designs I've been looking at don't seem to be able to do this at > >such a high sampling rate. &#4294967295; > > >Any suggestions? &#4294967295;Would downsampling help? > > >Thank you in advance for your help > > >Allison &#4294967295; > > Thank you all for your helpful advice, it's nice to hear from people who > clearly know &#4294967295;a lot more than me! > > I think my problem is that I'm being lazy, and trying to implement the > filter straight in matlab using a butterworth filter. &#4294967295; > > After listening to your advice I realised I need to think a bit more about > IIR filters, so I went to Matlab help, which gave me this advice: > > &#4294967295; "All classical IIR lowpass filters are ill-conditioned for extremely low > cut-off frequencies. Therefore, instead of designing a lowpass IIR filter > with a very narrow passband, it can be better to design a wider passband > and decimate the input signal." > > Which I'm presuming means down sample? &#4294967295;I can afford to down sample, so I > think I should do that. &#4294967295; > > I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm > really only looking at frequencies up to 100Hz at the minute. &#4294967295; And in case > your interested, it's recorded data, interneural recordings, and I did my > utmost to avoid noise during recording. &#4294967295; > > So I'm going to try downsampling and see if that works, and if not I'll go > back and study up on filter design and implementation. &#4294967295; > > Thanks again for all your help! > > Allison- Hide quoted text - > > - Show quoted text -
Recorded analog or digital? Makes a difference. Dirk
abradley1984 wrote:

   ...

> Thank you all for your helpful advice, it's nice to hear from people who > clearly know a lot more than me! > > I think my problem is that I'm being lazy, and trying to implement the > filter straight in matlab using a butterworth filter. > > After listening to your advice I realised I need to think a bit more about > IIR filters, so I went to Matlab help, which gave me this advice: > > "All classical IIR lowpass filters are ill-conditioned for extremely low > cut-off frequencies. Therefore, instead of designing a lowpass IIR filter > with a very narrow passband, it can be better to design a wider passband > and decimate the input signal."
Note the reference to lowpass. I don't think that applies to notch filters, unless by "ill conditioned" they have in mind the numerical issues that Tim Wescott raised.
> Which I'm presuming means down sample? I can afford to down sample, so I > think I should do that.
It does and you should. In the process, you might use a low pass filter that cuts out the 120 Hz noise.
> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm > really only looking at frequencies up to 100Hz at the minute. And in case > your interested, it's recorded data, interneural recordings, and I did my > utmost to avoid noise during recording.
May I respectfully submit that your utmost could probably be improved upon? Consider how clean EEG and EKG traces can be.
> So I'm going to try downsampling and see if that works, and if not I'll go > back and study up on filter design and implementation.
Good luck!
> Thanks again for all your help!
Keep in touch. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
"abradley1984" <abradley1984@gmail.com> wrote in
news:AsGdnV6jK46fsiXVnZ2dnUVZ_hWdnZ2d@giganews.com: 

> > I'm aware of the harmonics of 60Hz, which I'm ignoring for now because > I'm really only looking at frequencies up to 100Hz at the minute. > And in case your interested, it's recorded data, interneural > recordings, and I did my utmost to avoid noise during recording.
That's different. The first question is "what are you trying to do. If its identify spikes, you might consider high-pass filtering instead of trying to notch out your line noise. If you really really need the waveform, and it has real info in the 50-60 Hz range, you might want to reconsider. If I were refereeing, I wouldn't like it. Does "utmost" include Faraday cage? To decimate, you need to low-pass filter first, and you might lose some valuable signal. Another quick and dirty trick would be to FFT, zero out the 60 Hz component, and then ifft. If it doesn't work, you haven't wasted much time. -- Scott Reverse name to reply
abradley1984" <abradley1984@gmail.com> wrote,

> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because > I'm really only looking at frequencies up to 100Hz at the minute. > And in case your interested, it's recorded data, interneural > recordings, and I did my utmost to avoid noise during recording.
In this case I would remove the 60 Hz fundamental and its second harmonic (and probably, the third harmonic) by a correlation/subtraction approach, and filter down to 100 Hz bandwidth with a fairly low-order filter (3rd - to 6-th order, I would say). On this dataset a Hamming window of length around 10 * (1 / 60Hz) prior to correlation would be about right. I'd avoid high-Q notch filters, higher-order low-pass filters, or sample rate conversion as these will merely distort your data and are not necessary for your problem. Trying to filter out the 120 Hz component with a sharp LPF when there is signal of interest up to 100 Hz is not very attractive. Steve

abradley1984 wrote:

> I think my problem is that I'm being lazy, and trying to implement the > filter straight in matlab using a butterworth filter.
Being lazy is a serious problem. There is no solution to it.
> After listening to your advice I realised I need to think a bit more about > IIR filters, so I went to Matlab help, which gave me this advice: > > "All classical IIR lowpass filters are ill-conditioned for extremely low > cut-off frequencies. Therefore, instead of designing a lowpass IIR filter > with a very narrow passband, it can be better to design a wider passband > and decimate the input signal."
This looks like a meaningless set of adjectives and global assertions. The loss of numeric precision at low frequency (Fc/Fs <<< 1) in a direct form biquad is at the order of Q*(Fc/Fs)^2. In your case, the losses are going to be about 14 bits or so. You will definitely be fine with the 32 bit integer or the double precision float. Besides, there are the methods to improve the precision (state variable filters, noise shaping and such).
> Which I'm presuming means down sample? I can afford to down sample, so I > think I should do that.
You don't have to. Although 25kHz for EEG is definitely an overkill.
> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm > really only looking at frequencies up to 100Hz at the minute. And in case > your interested, it's recorded data, interneural recordings, and I did my > utmost to avoid noise during recording.
If this is the recorded data, you can just subtract the unwanted signal from it. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in news:OWduk.25815
$Ri.11814@flpi146.ffdc.sbc.com:

> Although 25kHz for EEG is definitely an overkill.
Is that what Interneural Recordings are?? If so, the frequency range of interest goes to about 100Hz, so 500Hz should be all you need. -- Scott Reverse name to reply
Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in news:OWduk.25815
$Ri.11814@flpi146.ffdc.sbc.com:

> If this is the recorded data, you can just subtract the unwanted signal > from it. >
Easy to say, harder to do. The noise can change with any movement, in my experience. Even the impedance plethysmography signal can change the size of the noise with breathing. You can mess around a good long time before you realize you can only do so much with correlation/subtraction methods. -- Scott Reverse name to reply
>Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in
news:OWduk.25815
>$Ri.11814@flpi146.ffdc.sbc.com: > >> Although 25kHz for EEG is definitely an overkill. > > >Is that what Interneural Recordings are?? If so, the frequency range of
>interest goes to about 100Hz, so 500Hz should be all you need. >-- >Scott >Reverse name to reply >
It's not EEG, I'm obviously no explaining myself very well. I'm basically sticking a microelectrode into the nerve and recording from that. So I need higher frequencies to see the spikes.