From: vectorizor on
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
From: Rob Gaddi on
On Wed, 24 Feb 2010 08:16:39 -0800 (PST)
vectorizor <vectorizor(a)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,
>
> A

An 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
From: Vladimir Vassilevsky on


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
From: Jerry Avins on
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.
�����������������������������������������������������������������������
From: Tim Wescott on
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,
>
> A

What 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