DSPRelated.com
Forums

IIR filter and intermittent 50 Hz noise

Started by Unknown November 26, 2015
Hi all,

I'm trying to filter out 50 Hz noise which intermitelly appears on the input signal, I've been trying to use a 6th order IIR filter but results are unsatisfied:

http://www.jrdltd.co.uk/data/noise.png

Is there any way to filter out such intermittent noise correctly without massive oscillation at transitions, please? Can you please point me to the resource where I could read about this? :-)

Here is a CSV for reference:
http://www.jrdltd.co.uk/data/noise.csv

Kind regards,
Krzysztof

I've designed hum removal algorithms for guitars in the past and they all have audible time-domain effects. You can't get around the basic time/frequency trade offs. What you refer to as oscillations are just the linear filter response to changes in the input. At 50hz any high-order filter will have an impulse response measured in seconds. So you need to relax the frequency-domain specifications if you want a shorter impulse response. The absolute minimum length filter with a notch at 50 hz is 1 + a delay corresponding to the half wavelength of 50 hz. But this is not a very selective filter , and also will have notches at odd harmonics. Alternatively you can use 1 - delay of full wavelength (20 ms) which has notches at all harmonics but also has a notch at DC which may be a problem for you. Note that if the source of your noise is a power line , chances are you will have harmonics as well, especially if you have a dimmer nearby, so using a filter that also attenuates harmonics may be a good thing. 

Bob
On 26/11/15 16:16, radams2000@gmail.com wrote:
> I've designed hum removal algorithms for guitars in the past and they all have audible time-domain effects. You can't get around the basic time/frequency trade offs. What you refer to as oscillations are just the linear filter response to changes in the input. At 50hz any high-order filter will have an impulse response measured in seconds. So you need to relax the frequency-domain specifications if you want a shorter impulse response. The absolute minimum length filter with a notch at 50 hz is 1 + a delay corresponding to the half wavelength of 50 hz. But this is not a very selective filter , and also will have notches at odd harmonics. Alternatively you can use 1 - delay of full wavelength (20 ms) which has notches at all harmonics but also has a notch at DC which may be a problem for you. Note that if the source of your noise is a power line , chances are you will have harmonics as well, especially if you have a dimmer nearby, so using a filter that also attenuates harmonics may b
e a good thing. It is worth actually looking at a 50Hz mains signal. Quite apart from it not being 50Hz, it doesn't even /look/ like a sine wave anymore: the peaks are noticably flattened by all the low-power electronic PSUs attached to the mains. The last time I did an FFT of it, 150Hz: -28dBc 250Hz: -32dBc 350Hz: -42dBc 450Hz: -46dBc
Or in other words, you may need to make the Q lower.
If you want to be fancy and make something dynamic,
 , try to keep the Q high when the tone is steady and lower the Q just  before there are changes to the tone.