From: Tim Wescott on
Michael Plante wrote:
> 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.
>

Right, and subject to numerous problems if the signal isn't just right.
I can't recall a specific instance where I've used something exactly
as I describe here -- I generally end up doing things block by block --
but there has to be _some_ time that it's useful!

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: suren on
On Feb 24, 9:16 pm, vectorizor <vectori...(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

Hi,
You could use a single pole IIR filter with time varying alpha (or 2
sets of alpha) to track the maxima.
y[n]=alpha*x[n] +(1-alpha)*y[n-1].
Essentially, if the input x[n] is greater than the previous output
y[n-1], use a faster alpha and if its smaller, use a smaller alpha.
This is like a fast attack and slow decay kind of a filter. This can
be used to track envelope efficiently.

Hope this helps.
regards
suren
From: vectorizor on
Thanks to all for all interesting answers. To refocus the
conversation, the signals being processed are images, so I dont need
to know the future :) , and a running min/max is not sufficient, as
I'm more looking for a smooth enveloppe, rather than one looking like
a step function.

> Hi,
> You could use a single pole IIR filter with time varying alpha (or 2
> sets of alpha) to track the maxima.
> y[n]=alpha*x[n] +(1-alpha)*y[n-1].
>  Essentially, if the input x[n] is greater than the previous output
> y[n-1], use a faster alpha  and if its smaller, use a smaller alpha.
> This is like a fast attack and slow decay kind of a filter. This can
> be used to track envelope efficiently.

This is the most interesting answer IMHO. I can see how it could
potentially give a smooth enveloppe. But how to control the alpha?
Could you give me more clues/point me to some reference materials?

Thanks again

A
From: suren on
On Feb 25, 3:04 pm, vectorizor <vectori...(a)googlemail.com> wrote:
> Thanks to all for all interesting answers. To refocus the
> conversation, the signals being processed are images, so I dont need
> to know the future :) , and a running min/max is not sufficient, as
> I'm more looking for a smooth enveloppe, rather than one looking like
> a step function.
>
> > Hi,
> > You could use a single pole IIR filter with time varying alpha (or 2
> > sets of alpha) to track the maxima.
> > y[n]=alpha*x[n] +(1-alpha)*y[n-1].
> >  Essentially, if the input x[n] is greater than the previous output
> > y[n-1], use a faster alpha  and if its smaller, use a smaller alpha.
> > This is like a fast attack and slow decay kind of a filter. This can
> > be used to track envelope efficiently.
>
> This is the most interesting answer IMHO. I can see how it could
> potentially give a smooth enveloppe. But how to control the alpha?
> Could you give me more clues/point me to some reference materials?
>
> Thanks again
>
> A

Hi,
That is quite simple. You need to use two parameters alpha_fast and
alpha_slow. A quick pseudo code is give below.
if (input>prev_output)
{
alpha = alpha_fast;
}
else
{
alpha = alpha_slow;
}
output = alpha*input + (1-alpha)*prev_output;
prev_output = output;

Hope this helps.

suren
From: Jerry Avins on
vectorizor wrote:
> Thanks to all for all interesting answers. To refocus the
> conversation, the signals being processed are images, so I dont need
> to know the future :) , and a running min/max is not sufficient, as
> I'm more looking for a smooth enveloppe, rather than one looking like
> a step function.
>
>> Hi,
>> You could use a single pole IIR filter with time varying alpha (or 2
>> sets of alpha) to track the maxima.
>> y[n]=alpha*x[n] +(1-alpha)*y[n-1].
>> Essentially, if the input x[n] is greater than the previous output
>> y[n-1], use a faster alpha and if its smaller, use a smaller alpha.
>> This is like a fast attack and slow decay kind of a filter. This can
>> be used to track envelope efficiently.
>
> This is the most interesting answer IMHO. I can see how it could
> potentially give a smooth enveloppe. But how to control the alpha?
> Could you give me more clues/point me to some reference materials?

Before going off on a wild goose chase, define /precisely/ what you mean
by "envelope". You can't compute what you can't define.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������