# How to differentiate between line frequency (50Hz) and the signal frequency of 50Hz? [closed]

I need to filter out line frequency of 50 Hz. As my signal may contain the frequency of 50 Hz, how can I remove the effect of line frequency of 50 Hz without losing the information in the signal?

The signal contains frequencies in the range 10 Hz to 500 Hz.

• is the signal you want to keep a pure harmonic oscillation, or something else? Does it vary in frequency or just stay the same frequency? Sep 26 at 17:46

[Nota: the bandwidth makes me think about field seismic signal, which has literature on 50 Hz and 60 Hz power line removal]

The question revolves on how much your signal differs from a sine at 50 Hz.

On the one hand, imagine that your signal is a pure 50 Hz frequency. It would be in indistinguishable from the power line disturbance. On the other hand, if it is very random (and quite independen), you could try to identifies the power line, and subtract it.

Between the two extremes, there are many techniques from non-parametric methods to parametric modeling. If you care for spectral methods, spectrum interpolation is described in Section 2.3 "Signal Processing: Power Line Noise Removal" from Reducing power line noise in EEG and MEG data via spectrum with spectrum interpolation code:

If power line noise interference is considered as an additional component – with a peak at 50 Hz – superimposed on the continuous power spectrum curve of MEG/EEG data, it can be removed by interpolating the curve of the power spectrum at the respective frequency samples

Another option is to exploit the potential of signal separation of transformation, like short-term Fourier transforms, and exploit similar masking or interpolation in the time-frequency or time-scale domain.

If you do a synchronous capture of (1) the 50 Hz line carrier without your signal, and (2) your signal, you may be able to subtract, or cancel out, any 50 Hz carrier in your signal, which will likely have a different phase and bandwidth than any independent modulated 50 Hz spectrum in your signal.

Ideas:

1. If 50 Hz envelope is smooth, you may be able to estimate (desired) signal power as recorded power less distubance power (spectral subtraction). For some applications this might be enough, but you will have phase distortion in your desired signal.

2. Assume that the contribution of «mains hum» is highly stationary, while the signal that you want (e.g. speech) is not. Use a method to estimate the slowly varying mains hum that is not disrupted by non-stationary signal. Subtract.

3. Use sources like the link below to uniquely estimate mains frequency in your area at the time. Estimate amplitude and subtract.

https://www.mainsfrequency.com/verlauf_en.htm

Lots of excellent answers here, to which I'm going to add two depressing ones:

1. If your signal is absolutely indistinguishable from line hum, then you can't filter out one without filtering out the other. You have to ask yourself (and find an answer) what the difference is between line hum and your desired signal.
2. The best way to filter out power line hum is to not pick it up in the first place. If you can find a way to record what you need to record without recording line hum, do so. Either find a way with line-powered equipment (for inspiration, do a web search on "humbucker pickups"), or find a way to battery-power your equipment (and somehow dodge the hum).