Jessica wrote:> On Oct 8, 2:04 am, Rune Allnor <all...@tele.ntnu.no> wrote: >> On 7 Okt, 20:59, Jessica <pt...@live.com> wrote: >> >>> It has been about 4 years since I last studied digital filters. I am >>> trying to find a low-pass causal filter with minimal time domain lag. >>> I would also be interested in a high-pass filter with minimal time >>> domain lag. I know there is a trade-off and I am not so concerned >>> about stop-band attenuation, but do want linear phase. >> Usually it's the other way around: Stop-band attenuation >> is the important factor in the design. If one were to take >> your priorities to the extreme, one might say that stop-band >> attenuation is irrelevant, in which case one might ask why >> you would need the filter at all? >> >> Rune > > I want some stopband attenuation, but I suppose the strongest priority > is minimum time domain lag.It's a fool's errand anyway. What you really want is a future predictor. So do I! Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →
Looking for low-pass causal filter with minimal time domain lag?
Started by ●October 7, 2009
Reply by ●October 8, 20092009-10-08
Reply by ●October 8, 20092009-10-08
On Thu, 08 Oct 2009 07:34:53 -0700, Jessica wrote:> On Oct 7, 10:32 pm, Tim Wescott <t...@seemywebsite.com> wrote: >> On Wed, 07 Oct 2009 11:59:42 -0700, Jessica wrote: >> > It has been about 4 years since I last studied digital filters. I am >> > trying to find a low-pass causal filter with minimal time domain lag. >> > I would also be interested in a high-pass filter with minimal time >> > domain lag. I know there is a trade-off and I am not so concerned >> > about stop-band attenuation, but do want linear phase. I would >> > prefer unity gain in the passband. Can anyone recommend such a >> > filter? Is there a good online guide or book about digital filters >> > -- with more of an application approach vs. theoretical. >> >> It sounds like you want to digitize a Bessel filter -- it's minimum >> phase, which means the snappiest time-domain response for the frequency >> response, and it has the most linear phase response of any >> minimum-phase filter. >> >> I don't know how common this is in digital-land -- it's mostly used in >> analog systems in a spot where you'd use a linear-phase FIR filter if >> it were a digital system. >> >> Tell us what you're planning on _doing_ with the filter and we may be >> able to help more. While you're at it, think about whether you need >> absolute dead-on linear phase response or just an approximation, how >> important unity pass-band gain is, etc. >> >> --www.wescottdesign.com > > I am a trader and I am trying to develop smoother technical indicators > than what I currently have (exponential moving average). Maybe the best > approach would be a dynamic ema of the form: > > y[n] = x[n]*alpha + y[n-1](1-alpha) > > where alpha varies based on some parameter of the signal -- dominant > cycle period, signal to noise ratio, etc. > > So the purpose of the smoother is to remove the noise or choppyness > (low-pass filter), but throw in too much lag due to the filtering and > whatever indicator is based on the smoothed data will be worthless.If the exponential moving average does what it's name sounds like it mimics a 1st-order lowpass IIR filter, which is minimum phase. You could certainly experiment with some higher-order filter if you wish. Your proposed filter is a first-order lowpass IIR filter, but with some nonlinearity because you're proposing to change the value of alpha with the signal characteristics. You could, for instance, set alpha low when y [n] doesn't differ much from x[n], and high when it does, on the theory that you want quick updates for large swings and slow updates when everything is going as expected. A Bessel filter would smooth more because it's higher order, but you may be disappointed by the lag -- you just can't get zero lag and lots of smoothing, at least not without seeing into the future. -- www.wescottdesign.com
Reply by ●October 8, 20092009-10-08
On Oct 8, 5:25�pm, Tim Wescott <t...@seemywebsite.com> wrote:> On Thu, 08 Oct 2009 07:34:53 -0700, Jessica wrote: > > On Oct 7, 10:32�pm, Tim Wescott <t...@seemywebsite.com> wrote: > >> On Wed, 07 Oct 2009 11:59:42 -0700, Jessica wrote: > >> > It has been about 4 years since I last studied digital filters. �I am > >> > trying to find a low-pass causal filter with minimal time domain lag. > >> > I would also be interested in a high-pass filter with minimal time > >> > domain lag. �I know there is a trade-off and I am not so concerned > >> > about stop-band attenuation, but do want linear phase. �I would > >> > prefer unity gain in the passband. �Can anyone recommend such a > >> > filter? �Is there a good online guide or book about digital filters > >> > -- with more of an application approach vs. theoretical. > > >> It sounds like you want to digitize a Bessel filter -- it's minimum > >> phase, which means the snappiest time-domain response for the frequency > >> response, and it has the most linear phase response of any > >> minimum-phase filter. > > >> I don't know how common this is in digital-land -- it's mostly used in > >> analog systems in a spot where you'd use a linear-phase FIR filter if > >> it were a digital system. > > >> Tell us what you're planning on _doing_ with the filter and we may be > >> able to help more. �While you're at it, think about whether you need > >> absolute dead-on linear phase response or just an approximation, how > >> important unity pass-band gain is, etc. > > >> --www.wescottdesign.com > > > I am a trader and I am trying to develop smoother technical indicators > > than what I currently have (exponential moving average). �Maybe the best > > approach would be a dynamic ema of the form: > > > y[n] = x[n]*alpha + y[n-1](1-alpha) > > > where alpha varies based on some parameter of the signal -- dominant > > cycle period, signal to noise ratio, etc. > > > So the purpose of the smoother is to remove the noise or choppyness > > (low-pass filter), but throw in too much lag due to the filtering and > > whatever indicator is based on the smoothed data will be worthless. > > If the exponential moving average does what it's name sounds like it > mimics a 1st-order lowpass IIR filter, which is minimum phase. �You could > certainly experiment with some higher-order filter if you wish. > > Your proposed filter is a first-order lowpass IIR filter, but with some > nonlinearity because you're proposing to change the value of alpha with > the signal characteristics. �You could, for instance, set alpha low when y > [n] doesn't differ much from x[n], and high when it does, on the theory > that you want quick updates for large swings and slow updates when > everything is going as expected. > > A Bessel filter would smooth more because it's higher order, but you may > be disappointed by the lag -- you just can't get zero lag and lots of > smoothing, at least not without seeing into the future. > > --www.wescottdesign.comThanks Tim, I agree, I was not expecting a magic filter. :-)







