Hi all, First of all, I'm a newbie in signal processing, so go easy :) I have used an IIR filter to computer the local average of a signal, and it works well. It essentially is what they call in finance a moving average, i.e. the output at a sample point is a fraction of itself and (1-fraction) of its predecessor. Results fit my requirements, and the speed is absolutely tremendous. Now, I would also like to find the enveloppe of the signal, i.e. the local minimum and maximum. I'm trying to find a way to do that using IIR filters (because of the speed), but I cannot for the life of me find a way forward. Does anybody have ideas on that? Note that it does not necessarily need to be a IIR filter, we can keep the conversation more general at first. I suggested them because of the level of performance they enabled, which is important to my project. Thanks in advance, A
IIR to find minimum, maximum enveloppe of a signal
Started by ●February 24, 2010
Reply by ●February 24, 20102010-02-24
On Wed, 24 Feb 2010 08:16:39 -0800 (PST) vectorizor <vectorizor@googlemail.com> wrote:> Hi all, > > First of all, I'm a newbie in signal processing, so go easy :) > > I have used an IIR filter to computer the local average of a signal, > and it works well. It essentially is what they call in finance a > moving average, i.e. the output at a sample point is a fraction of > itself and (1-fraction) of its predecessor. Results fit my > requirements, and the speed is absolutely tremendous. > > Now, I would also like to find the enveloppe of the signal, i.e. the > local minimum and maximum. I'm trying to find a way to do that using > IIR filters (because of the speed), but I cannot for the life of me > find a way forward. Does anybody have ideas on that? Note that it does > not necessarily need to be a IIR filter, we can keep the conversation > more general at first. I suggested them because of the level of > performance they enabled, which is important to my project. > > Thanks in advance, > > AAn IIR filter is a fundamentally linear process. Min/max is a non-linear operation. What you want is something that can detect a peak, some sort of "peak detector". -- Rob Gaddi, Highland Technology Email address is currently out of order
Reply by ●February 24, 20102010-02-24
vectorizor wrote:> Hi all, > > First of all, I'm a newbie in signal processing, so go easy :) > > I have used an IIR filter to computer the local average of a signal, > and it works well. It essentially is what they call in finance a > moving average, i.e. the output at a sample point is a fraction of > itself and (1-fraction) of its predecessor. Results fit my > requirements, and the speed is absolutely tremendous. > > Now, I would also like to find the enveloppe of the signal, i.e. the > local minimum and maximum.If you need to track local minimum/maximum within the time span T, you have to keep all history for the entire time span T. However, you may not have to do full search through T at every step.> I'm trying to find a way to do that using > IIR filters (because of the speed), but I cannot for the life of me > find a way forward. Does anybody have ideas on that?Are you asking how to know the future? Be sure, it is very-very-very difficult.> Note that it does > not necessarily need to be a IIR filter, we can keep the conversation > more general at first. I suggested them because of the level of > performance they enabled, which is important to my project.Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●February 24, 20102010-02-24
Vladimir Vassilevsky wrote:> > > vectorizor wrote: > >> Hi all, >> >> First of all, I'm a newbie in signal processing, so go easy :) >> >> I have used an IIR filter to computer the local average of a signal, >> and it works well. It essentially is what they call in finance a >> moving average, i.e. the output at a sample point is a fraction of >> itself and (1-fraction) of its predecessor. Results fit my >> requirements, and the speed is absolutely tremendous. >> >> Now, I would also like to find the enveloppe of the signal, i.e. the >> local minimum and maximum. > > If you need to track local minimum/maximum within the time span T, you > have to keep all history for the entire time span T. However, you may > not have to do full search through T at every step.If you track min/max within blocks, you need to remember only two values within the time window: least-so-far and most-so-far. Any new value outside the range that they define replaces one of them. If you need a running min/max for the last n intervals, then it is as Vlad wrote.>> I'm trying to find a way to do that using >> IIR filters (because of the speed), but I cannot for the life of me >> find a way forward. Does anybody have ideas on that? > > Are you asking how to know the future? Be sure, it is very-very-very > difficult.:-) ... Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 24, 20102010-02-24
vectorizor wrote:> Hi all, > > First of all, I'm a newbie in signal processing, so go easy :) > > I have used an IIR filter to computer the local average of a signal, > and it works well. It essentially is what they call in finance a > moving average, i.e. the output at a sample point is a fraction of > itself and (1-fraction) of its predecessor. Results fit my > requirements, and the speed is absolutely tremendous. > > Now, I would also like to find the enveloppe of the signal, i.e. the > local minimum and maximum. I'm trying to find a way to do that using > IIR filters (because of the speed), but I cannot for the life of me > find a way forward. Does anybody have ideas on that? Note that it does > not necessarily need to be a IIR filter, we can keep the conversation > more general at first. I suggested them because of the level of > performance they enabled, which is important to my project. > > Thanks in advance, > > AWhat everyone has said so far: * the moniker "IIR" implies a linear recursive filter, and the min/max operation is quite nonlinear * To do a running min/max you need to keep a full history (and I'd like Vladimir to give us a reference to the "don't have to do full search at each step") * To do a block/block min/max you just need to keep 'max so far' and 'min so far' -- I do this often, it's very handy. If you need finer resolution than the whole span of data you're tracking, you can do multiple blocks. And: You can implement a _non_-linear recursive filter, that forces its output to the signal maximum (or minimum) whenever -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●February 24, 20102010-02-24
Tim Wescott wrote:> * To do a running min/max you need to keep a full history > (and I'd like Vladimir to give us a reference to the > "don't have to do full search at each step")Let's say you need a running min/max through the past N samples. You only have to do full search through N when the known min or max is dropped out of scope of N, i.e. lost in the past. Otherwise you compare the new sample to the current values of min and max - that's just one operation. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●February 24, 20102010-02-24
Tim Wescott wrote: ...> You can implement a _non_-linear recursive filter, that forces its > output to the signal maximum (or minimum) wheneverWhenever what? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●February 24, 20102010-02-24
vectorizor wrote:> Hi all, > > First of all, I'm a newbie in signal processing, so go easy :) > > I have used an IIR filter to computer the local average of a signal, > and it works well. It essentially is what they call in finance a > moving average, i.e. the output at a sample point is a fraction of > itself and (1-fraction) of its predecessor. Results fit my > requirements, and the speed is absolutely tremendous. > > Now, I would also like to find the enveloppe of the signal, i.e. the > local minimum and maximum. I'm trying to find a way to do that using > IIR filters (because of the speed), but I cannot for the life of me > find a way forward. Does anybody have ideas on that? Note that it does > not necessarily need to be a IIR filter, we can keep the conversation > more general at first. I suggested them because of the level of > performance they enabled, which is important to my project. > > Thanks in advance, > > AWhat everyone has said so far: * the moniker "IIR" implies a linear recursive filter, and the min/max operation is quite nonlinear * To do a running min/max you need to keep a full history (and I'd like Vladimir to give us a reference to the "don't have to do full search at each step") * To do a block/block min/max you just need to keep 'max so far' and 'min so far' -- I do this often, it's very handy. If you need finer resolution than the whole span of data you're tracking, you can do multiple blocks. And: You can implement a _non_-linear recursive filter, that forces its output to the signal value if the signal value exceeds it's state, but otherwise implements a first order low-pass (which is DSP for the Economist's 'moving average' filter). For signals which hit their maxima often this works pretty well, but if you're looking for an infrequent but guaranteed maximum this will often be wrong. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●February 24, 20102010-02-24
Jerry Avins wrote:> Tim Wescott wrote: > > ... > >> You can implement a _non_-linear recursive filter, that forces its >> output to the signal maximum (or minimum) whenever > > Whenever what? > > JerryUhh, whenever Thunderbird hiccups and deletes part of a message? (I resent) -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●February 24, 20102010-02-24
Tim wrote:>vectorizor wrote: >> Now, I would also like to find the enveloppe of the signal, i.e. the >> local minimum and maximum. I'm trying to find a way to do that using >> IIR filters (because of the speed), but I cannot for the life of me >> find a way forward. Does anybody have ideas on that? Note that it does >> not necessarily need to be a IIR filter, we can keep the conversation >> more general at first. I suggested them because of the level of >> performance they enabled, which is important to my project. > > >You can implement a _non_-linear recursive filter, that forces its >output to the signal value if the signal value exceeds it's state, but >otherwise implements a first order low-pass (which is DSP for the >Economist's 'moving average' filter). For signals which hit their >maxima often this works pretty well, but if you're looking for an >infrequent but guaranteed maximum this will often be wrong.Essentially an idealized diode envelope detector, right? It'd be interesting to know what additional tricks can be played digitally, though I imagine it's pretty dependent on prior knowledge about the signal.






