Ok guys, I have been looking through several post on doing a brick wall filter after converting a signal to the frequency domain and then back to the time domain. It seems this is acceptable sometimes but can also have effects on the signal when converted back to the time domain. Here is what I am trying to do. I am recording a signal at low voltage and the only relevant freqs are below say 80Hz. I am going to take measurements at say 600hz for a minute. The data will be collected before the analysis of the signal is to begin. What is the best way to ensure that I have no frequencies above 80Hz? Is it doing a brick wall or will this have side effects? As my handle says I am a newb to dsp. Thanks in advance.
Using FFT for Brick Wall filtering
Started by ●September 18, 2010
Reply by ●September 18, 20102010-09-18
On Sep 18, 8:26�am, "1Newb" <c646013@n_o_s_p_a_m.bofthew.com> wrote:> Ok guys, > > I have been looking through several post on doing a brick wall filter after > converting a signal to the frequency domain and then back to the time > domain. > > It seems this is acceptable sometimes but can also have effects on the > signal when converted back to the time domain. > > Here is what I am trying to do. �I am recording a signal at low voltage and > the only relevant freqs are below say 80Hz. �I am going to take > measurements at say 600hz for a minute. �The data will be collected before > the analysis of the signal is to begin. �What is the best way to ensure > that I have no frequencies above 80Hz? �Is it doing a brick wall or will > this have side effects?well, there is no such thing as a perfect brickwall filter because it would have an impulse response that is non-causal and extends forever in both the future and past directions. using the FFT to do filtering requires that you somehow splice and overlap your segments in time. if you divide your signal up into segments, run that into an FFT, wipe out everything above 80 Hz and then send it back with the iFFT, you will have artifacts at the segment splice points. this is because the FFT (or DFT) does what we call "circular convolution". if you're sampling at 600 Hz and for just a minute, then you have only 36000 samples. i would suggest a straight FIR convolution with something like a windowed sinc function. so, first decide on how bricky-wall you want your FIR filter to be. let's say N samples long: h[n] = (80/600)*sinc(80/600*n) * (1+cos(2*pi*n/N))/2 for |n| < N/2 . (i'm using a Hann window.) then your output is N/2 y[n] = SUM{ h[i] * x[n-i] } i=-N/2 so zero-append the 36000 samples with N/2 zero samples on both sides and do the above summation for each of your 36000 output samples. should take your computer all of a second or two.> As my handle says I am a newb to dsp.Vlad loves newb's showing up here. r b-j
Reply by ●September 18, 20102010-09-18
On 09/18/2010 08:13 AM, robert bristow-johnson wrote:> On Sep 18, 8:26 am, "1Newb"<c646013@n_o_s_p_a_m.bofthew.com> wrote: >> Ok guys, >> >> I have been looking through several post on doing a brick wall filter after >> converting a signal to the frequency domain and then back to the time >> domain. >> >> It seems this is acceptable sometimes but can also have effects on the >> signal when converted back to the time domain. >> >> Here is what I am trying to do. I am recording a signal at low voltage and >> the only relevant freqs are below say 80Hz. I am going to take >> measurements at say 600hz for a minute. The data will be collected before >> the analysis of the signal is to begin. What is the best way to ensure >> that I have no frequencies above 80Hz? Is it doing a brick wall or will >> this have side effects? > > well, there is no such thing as a perfect brickwall filter because it > would have an impulse response that is non-causal and extends forever > in both the future and past directions.Robert, that's just not true! You can have a perfect brickwall filter that's causal, you'd just have to build in an infinite amount of delay, and wait twice as long for it to settle out. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●September 18, 20102010-09-18
On 09/18/2010 05:26 AM, 1Newb wrote:> Ok guys, > > I have been looking through several post on doing a brick wall filter after > converting a signal to the frequency domain and then back to the time > domain. > > It seems this is acceptable sometimes but can also have effects on the > signal when converted back to the time domain. > > Here is what I am trying to do. I am recording a signal at low voltage and > the only relevant freqs are below say 80Hz. I am going to take > measurements at say 600hz for a minute. The data will be collected before > the analysis of the signal is to begin. What is the best way to ensure > that I have no frequencies above 80Hz? Is it doing a brick wall or will > this have side effects?Depending on what you're doing you may find relevant frequencies above 80Hz after all. You might want to say and let us help. You can have a really sharp filter, but the smaller the transition band the longer the transients. If nothing else matters, decide how much ringing you can stand from a square pulse, and design your filter accordingly. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●September 18, 20102010-09-18
On 9/18/10 8:26 AM, 1Newb wrote:> Ok guys, > > I have been looking through several post on doing a brick wall filter after > converting a signal to the frequency domain and then back to the time > domain. > > It seems this is acceptable sometimes but can also have effects on the > signal when converted back to the time domain. > > Here is what I am trying to do. I am recording a signal at low voltage and > the only relevant freqs are below say 80Hz. I am going to take > measurements at say 600hz for a minute. The data will be collected before > the analysis of the signal is to begin. What is the best way to ensure > that I have no frequencies above 80Hz? Is it doing a brick wall or will > this have side effects?If you are sampling at 600 hz, then the analog signal you are sampling must be bandlimited in the analog domain, i.e. BEFORE sampling, to 300 hz. If you don't do this, then a signal component at say 550hz will appear at 50 hz, corrupting the real spectrum you care about, and no digital filtering after the fact, no matter how "brick wall" can remove it. Filtering after sampling is useful if you want to remove components above 80 hz so that you can re-sample at a lower rate like 160 hz. see: http://en.wikipedia.org/wiki/Nyquist_frequency http://en.wikipedia.org/wiki/Downsampling Also, it's generally a bad idea to use an FFT for filtering. Use a FIR or IIR lowpass filter. The FFT will only give good results if the period of the analog signal is exactly matched to the FFT length (google FFT bin leakage). -Jeff
Reply by ●September 18, 20102010-09-18
On Sep 19, 12:26�am, "1Newb" <c646013@n_o_s_p_a_m.bofthew.com> wrote:> Ok guys, > > I have been looking through several post on doing a brick wall filter after > converting a signal to the frequency domain and then back to the time > domain. > > It seems this is acceptable sometimes but can also have effects on the > signal when converted back to the time domain. > > Here is what I am trying to do. �I am recording a signal at low voltage and > the only relevant freqs are below say 80Hz. �I am going to take > measurements at say 600hz for a minute. �The data will be collected before > the analysis of the signal is to begin. �What is the best way to ensure > that I have no frequencies above 80Hz? �Is it doing a brick wall or will > this have side effects? > > As my handle says I am a newb to dsp. > > Thanks in advance.It's not a brick wall filter since 1 frequency bin is N/fs. Hence you can never go to zero amplitude in one freq bin. Hardy
Reply by ●September 18, 20102010-09-18
On 9/18/2010 8:56 AM, Jeff Cunningham wrote:> > Also, it's generally a bad idea to use an FFT for filtering. Use a FIR > or IIR lowpass filter. The FFT will only give good results if the period > of the analog signal is exactly matched to the FFT length (google FFT > bin leakage). > > -JeffActually, it's often a *good* idea. And, if there is a finite sequence in time the damage is already done and FFT has nothing to do with it. Fred
Reply by ●September 18, 20102010-09-18
On 09/18/2010 08:56 AM, Jeff Cunningham wrote:> On 9/18/10 8:26 AM, 1Newb wrote: >> Ok guys, >> >> I have been looking through several post on doing a brick wall filter >> after >> converting a signal to the frequency domain and then back to the time >> domain. >> >> It seems this is acceptable sometimes but can also have effects on the >> signal when converted back to the time domain. >> >> Here is what I am trying to do. I am recording a signal at low voltage >> and >> the only relevant freqs are below say 80Hz. I am going to take >> measurements at say 600hz for a minute. The data will be collected before >> the analysis of the signal is to begin. What is the best way to ensure >> that I have no frequencies above 80Hz? Is it doing a brick wall or will >> this have side effects? > > If you are sampling at 600 hz, then the analog signal you are sampling > must be bandlimited in the analog domain, i.e. BEFORE sampling, to 300 hz. > > If you don't do this, then a signal component at say 550hz will appear > at 50 hz, corrupting the real spectrum you care about, and no digital > filtering after the fact, no matter how "brick wall" can remove it. > > Filtering after sampling is useful if you want to remove components > above 80 hz so that you can re-sample at a lower rate like 160 hz. > > see: > http://en.wikipedia.org/wiki/Nyquist_frequency > http://en.wikipedia.org/wiki/DownsamplingBut be careful about what you think when you hear "bandlimit to 1/2 the sample rate". This often leads to errors in design: http://www.wescottdesign.com/articles/Sampling/sampling.html.> Also, it's generally a bad idea to use an FFT for filtering. Use a FIR > or IIR lowpass filter. The FFT will only give good results if the period > of the analog signal is exactly matched to the FFT length (google FFT > bin leakage).I disagree. The FFT is perhaps overused by newbies, but it's not a bad tool to have to hand. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●September 18, 20102010-09-18
HardySpicer <gyansorova@gmail.com> wrote:> On Sep 19, 12:26�am, "1Newb" <c646013@n_o_s_p_a_m.bofthew.com> wrote:>> I have been looking through several post on doing a brick wall filter(snip)> It's not a brick wall filter since 1 frequency bin is N/fs. Hence you > can never go to zero amplitude in one freq bin.lim N--> infinity. Note the previous post on how long it takes. -- glen
Reply by ●September 20, 20102010-09-20
For this I am only interested in frequencies that are visible. Yes I know that should be around 60Hz but want to see up to 80Hz for assurance. I see it stated that the FFT is overused, would it be recommended for looking for cyclic patterns within the data? That was my original use of the FFT was going to be for but had it suggested to me to use it as a brick wall instead of an FIR filter. I am going to read more into setting up an FIR filter are there any recommendations or caveats that I need to be aware of? Thanks again to all whom have replied.






