DSPRelated.com
Forums

Filtering In Frequency Domain v Time Domain

Started by Bret Cahill March 5, 2011
A low pass time domain filter has a roll off.  A low pass Fourier
transform frequency filter can eliminate all the frequencies above a
cutoff frequency 100% without attenuating any of the lower frequencies
at all.

If the goal is to determine a phase angle between two signals, is
there any advantage in low pass filtering in the time domain before
frequency filtering in the frequency domain?


Bret Cahill



On Sat, 5 Mar 2011 09:49:41 -0800 (PST), Bret Cahill
<BretCahill@peoplepc.com> wrote:

>A low pass time domain filter has a roll off. A low pass Fourier >transform frequency filter can eliminate all the frequencies above a >cutoff frequency 100% without attenuating any of the lower frequencies >at all. > >If the goal is to determine a phase angle between two signals, is >there any advantage in low pass filtering in the time domain before >frequency filtering in the frequency domain? > > >Bret Cahill > >
A filter is a filter. Which domain (and there are more than two) you prefer to evaluate it in is your choice. John
On 3/5/2011 9:49 AM, Bret Cahill wrote:
> A low pass time domain filter has a roll off. A low pass Fourier > transform frequency filter can eliminate all the frequencies above a > cutoff frequency 100% without attenuating any of the lower frequencies > at all. > > If the goal is to determine a phase angle between two signals, is > there any advantage in low pass filtering in the time domain before > frequency filtering in the frequency domain? > > > Bret Cahill
Bret, Well........... From an operational point of view, of course "filter can eliminate all the frequencies above a cutoff frequency 100%" by multiplying (perhaps actually replacing) with zeros. But, you have to ask yourself what this does in the time domain. Any flat-zero segment in one domain will create an "infinite" sequence in the transform. This is what happens when we zero-pad a time sequence in order to have higher frequency resolution or to implement circular convolution. This doesn't mean, necessarily, that doing something like this is "bad". You just have to know a bit about what you're doing. One of my favorite applications of doing just that is this: - The objective is temporal interpolation of a sequence - which is basically an increase of the sample rate with some filtering involved. - One simple way is to intersperse a bunch of regular, zero-valued samples in time and then pass the new padded sequence through a lowpass filter in order to get nonzero values where those added zeros were place. - Another way is to rather "assume" the new sample rate and plot the new frequency content. This will look like the original spectrum but repeated as many times as the interpolation factor "I". THEN, we lowpass filter (by multiplying in frequency) to remove all of the energy bumps at fsOLD, 2fsOLD .... up to but not including the fsNEW. That suggests the same process you describe. The real trick here is to not create any "sharp edges" when multiplying by a contiguous sequence of zeros. If you do, there will be stuff spread out in time just the transform dual of spectral spreading when we use a rectangular window in time. So, one approach in this interpolation case is to do this. - Assume we know little or nothing of the signal spectrum because, after all, we're building an interpolation "system". So, if we just multiply by a sequence of zeros, we have no idea what anomalies we're creating. - Do the interpolation in stages. In fact, the first stage would be to repeat the spectral sequence to only 2fsOLD and then lowpass filter the data with an actual LPF - so that the spectral energy is fairly well limited to 1/4 the fsNEW1 or 1/2 fsOLD. Only now can you know that the spectral data at fsNEW/4 to 3fsNEW/4 will be "nearly zero". - Now you can pad the spectral sequence with zeros symmetrically about fs/2 - effectively increasing the value of fs or N ... whichever way you like to think of it. This padding operation is exactly like what we do in the time domain when we want higher N but have limited data - for whatever reason. NOTE: This padding is exactly the same as looking at the repeated spectrum up to I*fsOLD and then multiplying that sequence with zeros from fsOLD/2 to fsNEW-fsOLD/2. In effect, the edges of the zero sequence will fall on frequencies where there is little energy (due to the prefiltering). And so, there will be assuredly little temporal spreading caused by doing this. So this is an example of doing what you want but taking the precaution of pre-filtering before multplying by a sequence of zeros. It's the same sort of thing as doing windowing in time to reduce the effects of rectangular windowing - done in advance of zero padding in time. But, in this case our "window" in frequency has the shape of an actual lowpass filter - which is a "rectangular window with smoothed edges and long (nonzero) stopband tails" So, that's a long-winded caveat. Now on to your question: First of all, "time domain" filtering and "frequency domain filtering" are two different animals. You can't do temporal IIR filtering in frequency unless it's a special case made to look like a FIR. So that's a limitation of sorts. And, you are forcing yourself to do block or finite sequence oriented processing. If your objective is to deal with streaming data then maybe time domain processing is better - or you will have to deal with how to combine the blocks. The advantage of frequency domain filtering is that it can save a LOT of compute time if the (FIR) filter has any appreciable length. As long as you pay attention to the sequence lengths and what that means in your system then I see no reason to do time domain filtering *before* frequency domain filtering. Also remember that frequency domain filtering is equivalent to circular convolution in time and the temporal sequences have to account for that (be zero padded) to avoid overlap in time. Fred
On 3/5/2011 11:22 AM, Fred Marshall wrote:
> This padding is exactly the same as looking at the repeated spectrum up > to I*fsOLD and then multiplying that sequence with zeros from fsOLD/2 to > fsNEW-fsOLD/2.
Or, one might chose to have the zeros run from fsOLD to fsNEW-fsOLD so that the stopband of the lowpass filter are included, rather than forcing those values to zero as well. One might also imagine that avoiding sharp edges caused by multiplying by a sequence of zeros would be helped if the value and perhaps the first derivative of the original lowpassed sequence were to be zero at the edges of the "split point" .. the fs/2 point at this stage. So, if the requirements are particularly stiff then that might be a consideration. Again, similar to tapered time domain windowing ideas. Fred
Every filter has an impulse response. When modifying the DFT of a signal, then inverse DFTing the result, the effective transforms must be longer than the impulse response of the modifying function. (You can use long transforms or an overlap method.) How long is the impulse response of the brick-wall function you proposed?

Jerry
-- 
Engineering is the art of making what you want from things you can get.
> > This padding is exactly the same as looking at the repeated spectrum up > > to I*fsOLD and then multiplying that sequence with zeros from fsOLD/2 to > > fsNEW-fsOLD/2. > > Or, one might chose to have the zeros run from fsOLD to fsNEW-fsOLD so > that the stopband of the lowpass filter are included, rather than > forcing those values to zero as well. > > One might also imagine that avoiding sharp edges caused by multiplying > by a sequence of zeros would be helped if the value and perhaps the > first derivative of the original lowpassed sequence were to be zero at > the edges of the "split point" .. the fs/2 point at this stage. &#4294967295;So, if > the requirements are particularly stiff then that might be a > consideration. &#4294967295;Again, similar to tapered time domain windowing ideas.
What is interesting is how much time you can spend playing around with these transforms. Does a 10 degree lag phase angle in the reference introduce amplitude errors in match filtering? You can find out on Excel. Bret Cahill
> > > This padding is exactly the same as looking at the repeated spectrum up > > > to I*fsOLD and then multiplying that sequence with zeros from fsOLD/2 to > > > fsNEW-fsOLD/2. > > > Or, one might chose to have the zeros run from fsOLD to fsNEW-fsOLD so > > that the stopband of the lowpass filter are included, rather than > > forcing those values to zero as well. > > > One might also imagine that avoiding sharp edges caused by multiplying > > by a sequence of zeros would be helped if the value and perhaps the > > first derivative of the original lowpassed sequence were to be zero at > > the edges of the "split point" .. the fs/2 point at this stage. &#4294967295;So, if > > the requirements are particularly stiff then that might be a > > consideration. &#4294967295;Again, similar to tapered time domain windowing ideas. > > What is interesting is how much time you can spend playing around with > these transforms. > > Does a 10 degree lag phase angle in the reference introduce amplitude > errors in match filtering? > > You can find out on Excel.
Unlike phase sensitive filtering where the phase must be known to get the amplitude the phase of the reference must be irrelevant with match filtering. I'll check it out to make sure. Bret Cahill
Please clue me in here. What is "phase-sensitive filtering"? What kind of filter (aside from possibly a lock-in amplifier) needs a reference? 

Jerry
-- 
Engineering is the art of making what you want from things you can get.
On 3/5/2011 9:49 AM, Bret Cahill wrote:
> If the goal is to determine a phase angle between two signals,
Bret, What are you trying to do? If there are 2 sinusoids, at different frequencies, then there is no "phase angle" between them - although there may be a delay between them. If there are 2 sinusoids at the same frequency then, in the context of a single DFT, they will add and appear to be one sinusoid. But, maybe the system is different. If they happen at different times then there are other system considerations - as in "where is the time reference?" Fred
> > If the goal is to determine a phase angle between two signals, > > Bret, > > What are you trying to do?
Match filter with an out of phase reference. For awhile I thought it wouldn't matter and in fact the absolute value in the frequency domain is the same for two signals that are identical except for a phase angle.. But after trying it out on Excel it seems the phase angle must still be calculated from the real and imaginary components, the difference in the angles between the signals. The noise will probably require some kind of average of the phase angles. An iterative technique may be necessary. First you get an estimate of the phase angle from the noisy signal and reference then you phase adjust the reference then you match filter then you recheck to see if the phase angle is converging.
> If there are 2 sinusoids, at different frequencies, then there is no > "phase angle" between them - although there may be a delay between them.
Assume just one fundamental frequency.
> If there are 2 sinusoids at the same frequency then, in the context of a > single DFT, they will add and appear to be one sinusoid. =A0But, maybe th=
e
> system is different.
> If they happen at different times then there are other system > considerations - as in "where is the time reference?"
The SNR may be as high as 20 so hopefully one cycle will be enough. In that case only 90% of the noise needs to be eliminated. Bret Cahill