Forums

zero lag Butterworth filter

Started by adamchapman January 25, 2010
Im trying to implement a zero-lag butterworth Filtert as described in
tha paper at
http://www3.uta.edu/faculty/ricard/Grad%20Biomech/Pezzack/Robertson%20(2003)%20Design%20and%20responses%20of%20butterworth%20filters.pdf

My understanding is that the output of the filter needs to be reversed
and passed back through the filter a second time, but this time with
the data in reverse.

I think that in eqn(7) of the paper; for the second pass trought the
filter, I just replace the x's with the output of the first filter
pass, but the data multiplied by the "b" coefficients puzzle me. I
suppose they would be replaced with previous outputs of the second
filter pass.

However, I don't see how the data is reversed for this second pass.

Any help is greatly appreciated.
On Mon, 25 Jan 2010 12:55:46 -0800, adamchapman wrote:

> Im trying to implement a zero-lag butterworth Filtert as described in > tha paper at > http://www3.uta.edu/faculty/ricard/Grad%20Biomech/Pezzack/Robertson%20
(2003)%20Design%20and%20responses%20of%20butterworth%20filters.pdf
> > My understanding is that the output of the filter needs to be reversed > and passed back through the filter a second time, but this time with the > data in reverse.
Correct.
> > I think that in eqn(7) of the paper; for the second pass through the > filter, I just replace the x's with the output of the first filter pass, > but the data multiplied by the "b" coefficients puzzle me. I suppose > they would be replaced with previous outputs of the second filter pass.
Yes. The filter itself does not change, just the data that you pass through it.
> However, I don't see how the data is reversed for this second pass.
You have a vector of data x, with elements x[0] through x[n]. You run that through the filter specified by (7) once to get a filtered vector y. Then you set x[0] = y[n], x[1] = y[n-1], etc. to x[n] = y[0]. Then you run this new x through the _same_ filter to get the filtered vector y (which is in reverse time). Then you time-reverse y _again_ to get the answer you're looking for. In case this wasn't clear before, this algorithm only works after the fact -- you can't apply it in real time. -- www.wescottdesign.com
> In case this wasn't clear before, this algorithm only works after the > fact -- you can't apply it in real time.
Ah, I suppose it's useless for following stock prices then
On 27 Jan, 12:19, adamchapman <adamchapman1...@hotmail.co.uk> wrote:
> > In case this wasn't clear before, this algorithm only works after the > > fact -- you can't apply it in real time. > > Ah, I suppose it's useless for following stock prices then
Well - yes. And it has nothing to do with the filter being zero phase or real time or anything like that. Filters as used in DSP are designed from the assumption that the data are stationary, which stock market data are not. Stock market data are, to some extent, similar to random walk data, which DSP filters are not very well suited to deal with. So if you want to mess with data with random walk-type characteristics, you might want to find analysis methods that are better suited to random walk-type data. Rune
Rune Allnor wrote:
> On 27 Jan, 12:19, adamchapman <adamchapman1...@hotmail.co.uk> wrote: >>> In case this wasn't clear before, this algorithm only works after the >>> fact -- you can't apply it in real time. >> Ah, I suppose it's useless for following stock prices then > > Well - yes. > > And it has nothing to do with the filter being zero phase > or real time or anything like that. Filters as used in DSP > are designed from the assumption that the data are stationary, > which stock market data are not. > > Stock market data are, to some extent, similar to random > walk data, which DSP filters are not very well suited to > deal with. So if you want to mess with data with random > walk-type characteristics, you might want to find analysis > methods that are better suited to random walk-type data.
I want a filter that will tell me the name of a winner at the track tomorrow. If the stock market, why not the racetrack? Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
On Jan 25, 3:55&#2013266080;pm, adamchapman <adamchapman1...@hotmail.co.uk> wrote:
> Im trying to implement a zero-lag butterworth filter as described in > tha paper athttp://www3.uta.edu/faculty/ricard/Grad%20Biomech/Pezzack/Robertson%2... > > My understanding is that the output of the filter needs to be reversed > and passed back through the filter a second time, but this time with > the data in reverse.
are you referring to what is commonly called "filtfilt"? if so, the end response is not a butterworth, but some filter with |H (w)|^2.
> I think that in eqn(7) of the paper; for the second pass through the > filter, I just replace the x's with the output of the first filter > pass, but the data multiplied by the "b" coefficients puzzle me. I > suppose they would be replaced with previous outputs of the second > filter pass. > > However, I don't see how the data is reversed for this second pass.
is this real time? if not real time, isn't it obvious? but if it *is* real time, then one does it with a buffer and blocks of samples, and there's an issue of overlap-adding the results with those of the previous block. but it won't be *zero* lag. the end result will be constant delay for all frequencies, which can be considered "zero-lag" along with this known and fixed delay. r b-j