Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Low-pass causal filter with no time domain lag?

Status
Not open for further replies.

LinuxGuy

Newbie level 5
Newbie level 5
Joined
Oct 5, 2009
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,356
I want to build a low-pass filter that has no or very minimal lag in time domain (in other words, I want to use it for data smoothing, responsive to big changes in the data, but still good at filtering out noise). In order to do this, I think it's a requirement that the filter has 0 phase. I have heard that a causal filter for doing this is not possible. Can anyone point me to the closest known approximations for this filter?
 

You cannot fool Mother Nature. All low pass filters, including DSP ones have time delay.

Why do you need no time delay? Is it in some sort of feedback system?
 

    LinuxGuy

    Points: 2
    Helpful Answer Positive Rating
Maybe a better question would be: can someone explain to me how to design a low-pass filter that has low-frequency phase as close as possible to zero? I am trying to smooth data in real-time.
 

To lower the delay, you need to reduce the order of the filter to the minimum that gives you enough smoothing, nothing else can be done I think.

The filter just needs to take into account all the values from the past it has stored to calculate the new output.

Stefaan
 

LinuxGuy said:
I want to build a low-pass filter that has no or very minimal lag in time domain (in other words, I want to use it for data smoothing, responsive to big changes in the data, but still good at filtering out noise). ....

It is important, if you require really NO delay (impossible !) or perhaps CONSTANT delay within a certain band. This is a normal requirement for data filtering without much impact on data shape.
 

I thought about using positive feedback applied to a low-pass filter. The idea is that the gain on the positive feedback path is proportional to the actual filter output minus the input (gain proportional to error). This would allow the circuit to respond to large changes in input in real-time. However, feedback is really only used to adjust the poles of the overall system -- useful for where some part of the system cannot be controlled, but we wish to make the system stable or improve the response of the overall system. I am not sure how feedback could be useful when designing a digital filter because we already have complete control over the poles of the filter. Maybe the best idea is to take an exponential moving average:

y[n] = x[n]*(1-b) + b*y[n-1]

And then make b some function of the signal to noise ratio. But I don't know how to measure the signal without using another moving average...

Added after 3 minutes:

LvW said:
LinuxGuy said:
I want to build a low-pass filter that has no or very minimal lag in time domain (in other words, I want to use it for data smoothing, responsive to big changes in the data, but still good at filtering out noise). ....

It is important, if you require really NO delay (impossible !) or perhaps CONSTANT delay within a certain band. This is a normal requirement for data filtering without much impact on data shape.

If no delay is possible, then constant delay within a certain band should work. How do I shift delay -- low frequency lag vs. high frequency lag? I think this would require modifying the phase of the filter.
 

LinuxGuy said:
.............
............
If no delay is possible, then constant delay within a certain band should work. How do I shift delay -- low frequency lag vs. high frequency lag? I think this would require modifying the phase of the filter.

I don´t understand what you really mean - nevertheless, there are several low pass approximations with the aim to get nearly a "constant" group delay within the passband. The most popular is the Thomson-Bessel approach.
(By the way: constant group delay means linear phase slope)
 

    LinuxGuy

    Points: 2
    Helpful Answer Positive Rating
Perfect! Where did you learn of these filters? Can you recommend a good book?

Thanks!
 

LinuxGuy said:
Perfect! Where did you learn of these filters? Can you recommend a good book?
Thanks!

There are many filter books on the market and as the Thomson-Bessel approximation is a standard one, you will find it in any of these books.
For some raugh information: wikipedia or other papers to be found in the net.
 

The filter based on the allpass filter may fit.
When the allpass filter characteristic is Ha,
then the resulting characteristic is
Ha+Z^-d,
where Z^-d is the small delay to d=0,1,2 clocks.
Therefore, the filter group delay is only Z^-d , which is rather small.
 

    LinuxGuy

    Points: 2
    Helpful Answer Positive Rating
But the allpass filter does not actually do any stopband attenuation, does it? I don't need an ideal stopband transition (small as possible) or even high stopband attenuation. However, I would like some attenuation of higher frequencies, otherwise, no need to filter.
 

LinuxGuy said:
But the allpass filter does not actually do any stopband attenuation, does it? I don't need an ideal stopband transition (small as possible) or even high stopband attenuation. However, I would like some attenuation of higher frequencies, otherwise, no need to filter.

I wonder what you really need. It is absolutely not clear to me.
Do you have any specification or some damping requirements ?
By the way: an allpass filter is called "allpass" because it lets all frequencies pass through. There is absolutely no attenuation (just phase shift).
 

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.
 

y[n] = x[n]*alpha + y[n-1](1-alpha)
is simply a first order IIR respectively recursive low-pass, the digital equivalent to an simple analog low-pass.
 

But is there a better filter for my purpose -- more smoothing with less lag? A simple FIR filter is all that comes to mind.
 

A higher order IIR filter (Gauss/Bessel/Butterworth equivalent) would be my choose.
 

"By the way: an allpass filter is called "allpass" because it lets all frequencies pass through. There is absolutely no attenuation (just phase shift)."
It's really so. BUT
this filter is used as the separate unit rarely but only in the superposition.
Consider such a filter passes everything with the phase 0
but in the frequency F with the phase 180 degrees does.
And when the input signal is added directly to this filter output
then it is the genuine bandstop filter with the stop frequency F.
When is substracted then we get the bandpass filter with the peak at F.
Different filters can be built by this method.
And such filters are
- absolutely stable;
- frequency and other parameters are freely tuned;
- small coefficient number and its bit width.
That's all.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top