DSPRelated.com
Forums

DC filter

Started by ma January 22, 2007
Hello,

    I have a signal that has a large DC value. For example assume that I 
have a signal which is:



y=10^6 + sin( wt)



How can I remove the DC part of the signal? I tried a low pass filter, but 
there are two problems:

1- I can not set the filter to only remove DC value and not low frequency 
signals.

2- The filter has some gain even very low in DC so the DC value is not 
completely removed.



Any suggestion on any way that I can remove the DC signal?



Regards




ma wrote:
> Hello, > > I have a signal that has a large DC value. For example assume that I > have a signal which is: > > > > y=10^6 + sin( wt) > > > > How can I remove the DC part of the signal? I tried a low pass filter, but > there are two problems: > > 1- I can not set the filter to only remove DC value and not low frequency > signals. > > 2- The filter has some gain even very low in DC so the DC value is not > completely removed. > > > > Any suggestion on any way that I can remove the DC signal? > > > > Regards
Here's a good DC blocker: http://www.dspguru.com/comp.dsp/tricks/alg/dc_block.htm Do you really have DC that is 10^6 times greater than your signal? Basically removing the DC is removing the average from a signal. So if you want to best preserve low frequencies but remove DC, you need a very long history on the data. If you don't have to process the data in realtime, just load in the entire set of data, find its mean and subtract it away. If you do have to process in realtime, try R-BJ's method from the above link. Of course you will have a start up glitch and you will have to wait until that has decayed away. And of course one assumes your signal (desired portion) itself does not contain any DC. IHTH, Clay
"ma" <ma@nowhere.com> wrote in
news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk: 

> How can I remove the DC part of the signal? I tried a low pass filter, > but there are two problems:
Have you also tried a high-pass filter-- or is that what you really mean? -- Scott Reverse name to reply
"Scott Seidman" <namdiesttocs@mindspring.com> wrote in message 
news:Xns98C07F480418Bscottseidmanmindspri@130.133.1.4...
> "ma" <ma@nowhere.com> wrote in > news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk: > >> How can I remove the DC part of the signal? I tried a low pass filter, >> but there are two problems: > > Have you also tried a high-pass filter-- or is that what you really mean? > > -- > Scott > Reverse name to reply
Sorry, I mean a high pass filter. Thanks for correcting me. Regards
"ma" <ma@nowhere.com> wrote in
news:eO6th.120720$QY6.35932@fe1.news.blueyonder.co.uk: 

> > "Scott Seidman" <namdiesttocs@mindspring.com> wrote in message > news:Xns98C07F480418Bscottseidmanmindspri@130.133.1.4... >> "ma" <ma@nowhere.com> wrote in >> news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk: >> >>> How can I remove the DC part of the signal? I tried a low pass >>> filter, but there are two problems: >> >> Have you also tried a high-pass filter-- or is that what you really >> mean? >> >> -- >> Scott >> Reverse name to reply > > > Sorry, I mean a high pass filter. Thanks for correcting me. > > Regards > > >
Aside from post-collection problems you're now encountering, you might be creating a resolution problem when you sample. Perhaps AC coupling would be your best answer. You might get better help with more specifics-- sampling rate, voltage range, and frequency band of interest. If you do mean DC, and this isn't a real-time task, perhaps you can just generate the average value and subtract it from your data. Maybe you can average the first N samples, and do the subtraction, hoping that this first dumb pass will yield you a more tenable filtering problem. -- Scott Reverse name to reply
"ma" <ma@nowhere.com> wrote in message
news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk...
> Hello, > > I have a signal that has a large DC value. For example assume that I > have a signal which is: > > > > y=10^6 + sin( wt) > > > > How can I remove the DC part of the signal? I tried a low pass filter, but > there are two problems: >
First of all ac couple - solves problem outright. However, the way to get rid of DC is to introduce an extra zero at z=1 in the z-plane. F. -- Posted via a free Usenet account from http://www.teranews.com
Fitlike Min wrote:
> "ma" <ma@nowhere.com> wrote in message > news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk... >> Hello, >> >> I have a signal that has a large DC value. For example assume that I >> have a signal which is: >> >> >> >> y=10^6 + sin( wt) >> >> >> >> How can I remove the DC part of the signal? I tried a low pass filter, but >> there are two problems: >> > First of all ac couple - solves problem outright.
In other words, use an analog low-pass filter. Cynicism aside, that's good advice. Attacking trouble at the source is almost always the best way, and just think how the useful dynamic range is increased!
> However, the way to get rid of DC is to introduce an extra zero at z=1 in > the z-plane.
Funny: I penciled in a zero there and nothing happened. :-) Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
Jerry Avins <jya@ieee.org> wrote in news:uqGdnd9zPO7
_nyjYnZ2dnUVZ_rTinZ2d@rcn.net:

> In other words, use an analog low-pass filter. Cynicism aside, that's > good advice. Attacking trouble at the source is almost always the best > way, and just think how the useful dynamic range is increased! >
Definitely best practice, especially with the dynamic range concerns, but might also cause attenuation and/or phase problems in the frequency band of interest (which we still don't know). -- Scott Reverse name to reply
"Scott Seidman" <namdiesttocs@mindspring.com> wrote in message 
news:Xns98C08317D90C8scottseidmanmindspri@130.133.1.4...
> "ma" <ma@nowhere.com> wrote in > news:eO6th.120720$QY6.35932@fe1.news.blueyonder.co.uk: > >> >> "Scott Seidman" <namdiesttocs@mindspring.com> wrote in message >> news:Xns98C07F480418Bscottseidmanmindspri@130.133.1.4... >>> "ma" <ma@nowhere.com> wrote in >>> news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk: >>> >>>> How can I remove the DC part of the signal? I tried a low pass >>>> filter, but there are two problems: >>> >>> Have you also tried a high-pass filter-- or is that what you really >>> mean? >>> >>> -- >>> Scott >>> Reverse name to reply >> >> >> Sorry, I mean a high pass filter. Thanks for correcting me. >> >> Regards >> >> >> > > Aside from post-collection problems you're now encountering, you might be > creating a resolution problem when you sample. Perhaps AC coupling would > be your best answer. > > You might get better help with more specifics-- sampling rate, voltage > range, and frequency band of interest. If you do mean DC, and this isn't > a real-time task, perhaps you can just generate the average value and > subtract it from your data. Maybe you can average the first N samples, > and do the subtraction, hoping that this first dumb pass will yield you a > more tenable filtering problem. > > > > -- > Scott > Reverse name to reply
Hello, The signal is gnerated after processing some data and hence using AC coupled in ADC is not practical. The frequncy range is audio signal and sampling rate is around 1MHz. the dynamic range is 10^6 to 1 and since I have signal in a 32 bit integer, I have sufficent dynamic range. Regards
"ma" <ma@nowhere.com> wrote in
news:p18th.121031$QY6.10861@fe1.news.blueyonder.co.uk: 

> > "Scott Seidman" <namdiesttocs@mindspring.com> wrote in message > news:Xns98C08317D90C8scottseidmanmindspri@130.133.1.4... >> "ma" <ma@nowhere.com> wrote in >> news:eO6th.120720$QY6.35932@fe1.news.blueyonder.co.uk: >> >>> >>> "Scott Seidman" <namdiesttocs@mindspring.com> wrote in message >>> news:Xns98C07F480418Bscottseidmanmindspri@130.133.1.4... >>>> "ma" <ma@nowhere.com> wrote in >>>> news:bo2th.119065$QY6.46289@fe1.news.blueyonder.co.uk: >>>> >>>>> How can I remove the DC part of the signal? I tried a low pass >>>>> filter, but there are two problems: >>>> >>>> Have you also tried a high-pass filter-- or is that what you really >>>> mean? >>>> >>>> -- >>>> Scott >>>> Reverse name to reply >>> >>> >>> Sorry, I mean a high pass filter. Thanks for correcting me. >>> >>> Regards >>> >>> >>> >> >> Aside from post-collection problems you're now encountering, you >> might be creating a resolution problem when you sample. Perhaps AC >> coupling would be your best answer. >> >> You might get better help with more specifics-- sampling rate, >> voltage range, and frequency band of interest. If you do mean DC, >> and this isn't a real-time task, perhaps you can just generate the >> average value and subtract it from your data. Maybe you can average >> the first N samples, and do the subtraction, hoping that this first >> dumb pass will yield you a more tenable filtering problem. >> >> >> >> -- >> Scott >> Reverse name to reply > > > Hello, > The signal is gnerated after processing some data and hence using > AC > coupled in ADC is not practical. > The frequncy range is audio signal and sampling rate is around 1MHz. > the dynamic range is 10^6 to 1 and since I have signal in a 32 bit > integer, I have sufficent dynamic range. > > Regards > > > >
You left out the sample rate. In any case, I'd just average the first thousand points or so, and then subtract that number from the data. This should work, unless you don't mean "DC" Be very careful about your resolution, though. If your signal is >> smaller than 1e6 (info you haven't yet provided), you're probably only getting about 12 effective bits of resolution. -- Scott Reverse name to reply