DSPRelated.com
Forums

Is this 'clever' method of filtering legit?

Started by MartinC December 8, 2006
>Hi Martin, > >I think that your change in filter coefficient sets results in a time >varying change in frequency response that results in a modulation of >the data. > >The MATLAB 'filter' function used with A = 1.0 for a FIR filter >implementation and using the Zf and Zi parameters is an example of the >minimum size of storage to just read the data in once. try 'help >filter' in Matlab if you have it. > >If you can't afford to store this much data per channel you can avoid >storage by reading in a block of data of (blocksize + filterlength - 1) >size every blocksize samples and just running the normal length filter >to produce the correct number of outputs per block. This trades off a >little data bandwidth for maintaining data storage between filter >operations. > >Dale Dalrymple >http://dbdimages.com > >
Thanks Dale. Hey we could use a guy like you where I work! I guess I'll need to bite the bullet one way or another. The problem isn't really a lack of storage but rather working within the constraints of the legacy code. Life would be a lot easier if I could do all the necessary processing using just the block of data I have in hand at any given time. I don't suppose I could get something for nothing by transforming to the frequency domain, filtering there, then transorming back to the time domain, could I? I think I'd still need the next block so that I could overlap appropriately in the frequency domain and leave the gain unchanged. True? Good to hear from you again. I'll drop you a note a little later. Martin
MartinC wrote:
> >Hi Martin, > > > >I think that your change in filter coefficient sets results in a time > >varying change in frequency response that results in a modulation of > >the data.
...
> I guess I'll need to bite the bullet one way or another. The problem > isn't really a lack of storage but rather working within the constraints > of the legacy code. Life would be a lot easier if I could do all the > necessary processing using just the block of data I have in hand at any > given time. > > I don't suppose I could get something for nothing by transforming to the > frequency domain, filtering there, then transorming back to the time > domain, could I? I think I'd still need the next block so that I could > overlap appropriately in the frequency domain and leave the gain > unchanged. True?
You'd either have to buffer and overlap add/save, or you will end up with a similar problem: either the filter will include zero padding at the ends for a padded fft, or will filter in data from the opposite end of the buffer if you don't pad, due the circular effects of filtering that way. Another possibility would be to asymmetrically filter from the left, then identically filter from the right, then blend the two filter outputs using a ramp of some sort. You will probably still end up with boundry artifacts due to phase differences. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
>MartinC wrote: >> >Hi Martin, >> > >> >> I don't suppose I could get something for nothing by transforming to
the
>> frequency domain, filtering there, then transorming back to the time >> domain, could I? I think I'd still need the next block so that I
could
>> overlap appropriately in the frequency domain and leave the gain >> unchanged. True? > >You'd either have to buffer and overlap add/save, or you will end >up with a similar problem: either the filter will include zero padding >at the ends for a padded fft, or will filter in data from the opposite >end of the buffer if you don't pad, due the circular effects of >filtering that way.
Thanks Ron, Isn't there the problem as well that unless I use a rectangular window before I fft that I'll also need to undo the effect of that window on gain when I ifft? If the window rolls off the timeseries values to zero, I don't know that I can even do that without overlapping, can I? Martin
> >Another possibility would be to asymmetrically filter from the >left, then identically filter from the right, then blend the two >filter outputs using a ramp of some sort. You will probably >still end up with boundry artifacts due to phase differences. > > >IMHO. YMMV. >-- >rhn A.T nicholson d.0.t C-o-M > >