Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove unknown DC Offset from a non-periodic discrete time signal

Is there some process that can determine / remove an unknown DC offset from a non-periodic discrete time signal?

The signal in in question has a sample rate of 25Hz and has harmonics of interest between 0.25 and 3 Hz.

I have tried using highpass filters mixed results, first I used a 10th order guassian with Fc = 0Hz, this did a good job of removing the offset but it severly attenuated the AC aswell although it did leave the signal shape intact, next I used a 168th order equilripple with a stopband at 0Hz and passband at 0.25Hz, the phase shift was too severe and the signal shape too distorted, the distortion could probably be reduced if the pass-band was brought down to 0.1Hz but this would just further increase the phase shift which I need to keep to the very minimum.

Before and after applying x - LPF(x), as suggested by Paul R

enter image description here

like image 737
volting Avatar asked Aug 09 '11 09:08

volting


2 Answers

I recommend using a notch filter at DC and using filtfilt to make it zero phase.

a = [1 , -0.98]; b = [1,-1];

y = filtfilt(b,a,x);

The closer the second value of a gets to -1 the narrower your notch will be.

like image 133
Phonon Avatar answered Sep 30 '22 01:09

Phonon


A DC offset means that some constant value was added to the signal (the name originates from adding a DC voltage to an analog AC signal). If the DC component is really constant (and not changing really slowly), then you don't have to design some high-order (and potentially unstable) high-pass filters - you can just subtract the average of your signal from the signal - which is, of course, a high-pass filter as well (averaging is a type of a low-pass, and '1 minus the average' is high-apss) --- but a very simple one.

If, on the other hand, you have a reason to believe that the DC component is not really a DC, but rather an AC with very low frequency, then you'd better average segments of your signal and not the signal as a whole, which is the same as using a low-pass filter with impulse response which is shorter then the length of the signal. In this case you have to make some assumptions about the "DC" component.

like image 29
Itamar Katz Avatar answered Sep 30 '22 02:09

Itamar Katz