I need to create a lowpass digital filter with a very low lag. What type of filter could provide such a lag (look at link)? http://shareftp.narod.ru red points is the original data, blue and green curves - two different lowpass filters. PS: sorry for mistakes.. english isn't my native language.
How can I create filter with such a low lag?
Started by ●May 6, 2004
Reply by ●May 6, 20042004-05-06
Vadim wrote:> I need to create a lowpass digital filter with a very low lag. What > type of filter could provide such a lag (look at link)? > http://shareftp.narod.ru > > red points is the original data, blue and green curves - two different > lowpass filters. > > PS: sorry for mistakes.. english isn't my native language.You want a minimum- or near-minimum-phase filter. IIRs often come close, and asymmetric FIRs can be perfect. What are your flatness and cut-off needs? The only language error I see is that English isn't capitalized. You communicate well. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●May 7, 20042004-05-07
On 6 May 2004 17:17:32 -0700, Vadim <vostok8212@mail.ru> wrote:> I need to create a lowpass digital filter with a very low lag. What > type of filter could provide such a lag (look at link)? > http://shareftp.narod.ru > > red points is the original data, blue and green curves - two different > lowpass filters. > > PS: sorry for mistakes.. english isn't my native language.Looks like blue filter - bidirectional lowpass (with zero lag), green may be the same lowpass with much lower cutoff then blue applied in one direction (hence time lag) -- (2B)|~(2B)=?
Reply by ●May 7, 20042004-05-07
> Looks like > blue filter - bidirectional lowpass (with zero lag), > green may be the same lowpass with much lower cutoff then blue applied in > one direction (hence time lag)I forgot one thing. Filters must be causal. And in my opinion, bidirectional filter is noncausal. This picture was cut from the paper of one russian scientist. He didn't described what kind of filter it is, but mentioned, that this filter provide attenuation more then 40 dB in the stop band and absolutely don't distort magnitude and phase in the pass band. It's obvious from the picture, that his filters are great, but I doubt if they could be realised in practice. PS: most likely that this filters are both of one type. The one difference is their cutoff frequency.
Reply by ●May 7, 20042004-05-07
Unless you name the axes of your plot and put some units on them it's doubtful that someone can really help you with your request...! --smb vostok8212@mail.ru (Vadim) wrote in message news:<e58bda6b.0405061617.54b050bc@posting.google.com>...> I need to create a lowpass digital filter with a very low lag. What > type of filter could provide such a lag (look at link)? > http://shareftp.narod.ru > > red points is the original data, blue and green curves - two different > lowpass filters. > > PS: sorry for mistakes.. english isn't my native language.
Reply by ●May 7, 20042004-05-07
"Vadim" <vostok8212@mail.ru> wrote in message news:e58bda6b.0405061617.54b050bc@posting.google.com...> I need to create a lowpass digital filter with a very low lag. What > type of filter could provide such a lag (look at link)? > http://shareftp.narod.ru > > red points is the original data, blue and green curves - two different > lowpass filters. > > PS: sorry for mistakes.. english isn't my native language.Vadim, Jerry Avins already gave you pretty much the whole answer to your question if your objective is to have the lowest possible lag. "You want a minimum- or near-minimum-phase filter. IIRs often come close, and asymmetric FIRs can be perfect." His question: "What are your flatness and cut-off needs?" is very appropriate. Perhaps a little more insight: The more narrow the passband, the greater the "smoothness" of the response and the greater the lag. So, you want to design a filter with the widest possible pass band to get the shortest possible lag (and, minimum phase to get the shortest lag under these bandwidth circumstances). To avoid "ringing" at sharp edges you may also want to taper the transition from pass band to stop band - but you didn't ask about that. Actually, tapering the transition band and having a shorter FIR filter go hand in hand with having the least lag. The smoother the passband, the more attenuation in the stop band and the narrower the transition band all drive the filter to be longer and increases the lag. So, be modest in your requirements - particularly the stopband attenuation and the transition width - to get the shortest filter possible. So, I would do this: 1) decide how wide the passband can be - wider is better. This is a critical decision for you. If you have the luxury of being able to experiment then that may be a help in determining how wide. 2) Given the width, choose a design method that will yield a minimum phase filter. One such approach would design an odd-length symmetric FIR filter using something like the Parks-McClellan program or Matlab's "remez". Then add a small constant to the frequency response by increasing the center coefficient of the filter so that the entire frequency response is never negative. Then factor the filter impulse response / polynomial and remove all the zeros that are outside the unit circle and make any unit circle double zeros into single zeros. Then multiply out the resulting roots into a polynomial form to yield filter coefficients. This new filter will be minimum phase. The stop band ripple will be larger than you started with - measured in dB by a factor of two. So, if you need -40dB in the end, you need to design for -80dB at the beginning. The resulting filter will be 1/2 * (the length of the starting filter -1) +1 Later you said: "This picture was cut from the paper of one russian scientist. He didn't described what kind of filter it is, but mentioned, that this filter provide attenuation more then 40 dB in the stop band and absolutely don't distort magnitude and phase in the pass band." If there is "absolutely no phase distortion" in the pass band then this means one of two things: - the filter is linear phase and not minimum phase / minimum lag. - the filter is nearly linear phase in the passband which also means it probably isn't minimum phase / minimum lag. The lag factors shown in the pictures suggest that there is a very large difference between the two filters. The difference in apparent lags is much greater than a factor of 2. That is, the lag of the slower filter is maybe 10 times the lag of the faster filter. This suggests that a factor of 2 greater than "absolutely minimum lag" may be acceptable to you and that you can use a linear phase filter of the appropriate bandwidth to get absolutely no phase distortion and acceptable lag performance. So, again, I'd start with the filter bandwidth..... Fred
Reply by ●May 7, 20042004-05-07
In article <e58bda6b.0405061617.54b050bc@posting.google.com>, Vadim <vostok8212@mail.ru> wrote:>I need to create a lowpass digital filter with a very low lag.Is the data real-time or not? If the data is not real-time one might be able to use a "non-causal" filter to get zero or even negative lag. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
Reply by ●May 7, 20042004-05-07
Eh? Why would the lag matter if the data weren't real time? Syms. "Ronald H. Nicholson Jr." <rhn@mauve.rahul.net> wrote in message news:c7gr4h$9k5$2@blue.rahul.net...> > Is the data real-time or not? If the data is not real-time one might > be able to use a "non-causal" filter to get zero or even negative lag. >
Reply by ●May 7, 20042004-05-07
Symon wrote:> > Eh? Why would the lag matter if the data weren't real time?That's a good question. You should ask the OP. The image (the OP posted a link) he is aking about was clearly not done in real time and that is the entire explanation of why there is no lag. He also, made it clear that the filter used in that image was linear phase. So does he want to know about that filter, or about some other filter that is causal and has little or no lag? -jim -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Reply by ●May 8, 20042004-05-08
"Vadim" <vostok8212@mail.ru> wrote in message news:e58bda6b.0405061617.54b050bc@posting.google.com...> I need to create a lowpass digital filter with a very low lag. What > type of filter could provide such a lag (look at link)? > http://shareftp.narod.ru > > red points is the original data, blue and green curves - two different > lowpass filters. > > PS: sorry for mistakes.. english isn't my native language.An interesting way to design real-valued, discrete, minimum phase filters with delay constraints is by using the cosine decomposition of the log-magnitude of the frequency response. The cosine decomposition can be used, because the magnitude response of such filters is both even and periodic. A filter with a log-magnitude response given by: ln(|H(w)|)=Acos(kw) has minimum-phase group delay, in samples: D(w)=kAcos(kw) Furthermore if you add two log-magnitude responses together, you can just add their minimum-phase group delays together to get the minimum phase group delay of the resulting log-magnitude response. Because of this linear relationship, you can use a weighted least-squares fit to design the filter, optimizing the tradeoff between magnitude response errors (in DB), versus passband group delays (in samples). Oversample D(w) and ln(|H(w)|) by a factor of 8 or so when performing this fit. When you have an acceptable log-magnitude response, use a Hilbert transform to generate the phase response. Since you have the cosine decomposition of the log magnitude response, this is easy and exact -- just substitute sines for cosines. Then, exponentiate to get the frequency response (e^ln(H(w)) = H(w)). H(w) is guaranteed to represent a causal filter, with an infinite impulse response. Use whatever technique you like to find approximate truncated values for this response. Doing a sufficiently long IFFT, and discarding the last half of the resulting samples, will usually do the trick.






