From: Vladimir Vassilevsky on


Tim Wescott wrote:

> On Tue, 22 Dec 2009 20:50:42 -0600, Vladimir Vassilevsky wrote:
>>Tim Wescott wrote:
>>>On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>>
>>>
>>>
>>>>The dynamic range of a filter is limited by overflow at the top, and by
>>>>quantization artifacts at the bottom. We can try all variants of
>>>>assignment of poles and zeroes to different stages to maximize the
>>>>dynamic range from rms quantization noise to full scale sine wave at
>>>>the "worst" frequency. So far so good.
>>>>
>>>>However, this doesn't tell if some stage of filter can overflow if the
>>>>input is an arbitrary non-harmonic waveform. How could we optimize the
>>>>filter for this case?
>>>
>>>
>>1. Find the impulse response of stage #1, set stage #1 gain accordingly.
>>2. Find the impulse response of stages #1 + #2, set stage #2 gain
>>accordingly.
>>3. Find the impulse response of stages #1 + #2 + #3, set stage #3 gain
>>accordingly.
>>
>>So on, so forth.


> I suppose the next step is to apportion the stages so that the gains can
> remain as high as possible without allowing overflow -- I'll bet that's
> not as trivial.

Noise gain should be accounted for as well, so the only way is let the
computer go through all possible combinations of poles and zeroes for
all stages, compute S/N for each case, find best variant. For practical
filter orders, brute force checking all combinations is no big problem.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com




From: Tim Wescott on
On Tue, 22 Dec 2009 22:24:41 -0600, Vladimir Vassilevsky wrote:

> Tim Wescott wrote:
>
>> On Tue, 22 Dec 2009 20:50:42 -0600, Vladimir Vassilevsky wrote:
>>>Tim Wescott wrote:
>>>>On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>>>
>>>>
>>>>
>>>>>The dynamic range of a filter is limited by overflow at the top, and
>>>>>by quantization artifacts at the bottom. We can try all variants of
>>>>>assignment of poles and zeroes to different stages to maximize the
>>>>>dynamic range from rms quantization noise to full scale sine wave at
>>>>>the "worst" frequency. So far so good.
>>>>>
>>>>>However, this doesn't tell if some stage of filter can overflow if
>>>>>the input is an arbitrary non-harmonic waveform. How could we
>>>>>optimize the filter for this case?
>>>>
>>>>
>>>1. Find the impulse response of stage #1, set stage #1 gain
>>>accordingly. 2. Find the impulse response of stages #1 + #2, set stage
>>>#2 gain accordingly.
>>>3. Find the impulse response of stages #1 + #2 + #3, set stage #3 gain
>>>accordingly.
>>>
>>>So on, so forth.
>
>
>> I suppose the next step is to apportion the stages so that the gains
>> can remain as high as possible without allowing overflow -- I'll bet
>> that's not as trivial.
>
> Noise gain should be accounted for as well, so the only way is let the
> computer go through all possible combinations of poles and zeroes for
> all stages, compute S/N for each case, find best variant. For practical
> filter orders, brute force checking all combinations is no big problem.

Unaesthetic, but quite practical.

--
www.wescottdesign.com
From: Tim Wescott on
On Tue, 22 Dec 2009 23:04:06 -0500, Jerry Avins wrote:

> Vladimir Vassilevsky wrote:
>>
>>
>> Tim Wescott wrote:
>>> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>>
>>>
>>>> Let's say we need to implement H(z) = P(z)/Q(z) in the fixed point.
>>>> The typical implementation would be a cascade of biquads. So we
>>>> factor P(z) and Q(z) and distribute poles and zeroes between the
>>>> stages.
>>>>
>>>> The dynamic range of a filter is limited by overflow at the top, and
>>>> by quantization artifacts at the bottom. We can try all variants of
>>>> assignment of poles and zeroes to different stages to maximize the
>>>> dynamic range from rms quantization noise to full scale sine wave at
>>>> the "worst" frequency. So far so good.
>>>>
>>>> However, this doesn't tell if some stage of filter can overflow if
>>>> the input is an arbitrary non-harmonic waveform. How could we
>>>> optimize the filter for this case?
>>>>
>>> I _think_ that if the transfer function from input to each state in
>>> the filter is less than unity (or whatever the critical gain is
>>> necessary to prevent overflow) for all possible frequencies, you can't
>>> overflow.
>>> But I don't _know_ -- I'd have to try to prove it, and may end up
>>> disproving it instead!
>>
>> Unfortunately, not. Think of a highpass filter with the gain of 1 and
>> the data range is +/-1. Let the input -1,-1,-1....-1, +1, so here is
>> overflow.
>
> I think I remember a proof here that there are pathological waveforms --
> not the result of sampling -- that will cause any IIR structure to
> overflow. The worst case for a transversal filter is easy to demonstrate
> but unrealistically stringent.

Can't be, at least not for a stable filter. Any linear time-invariant
filter that's stable in the "poles strictly inside the stability region"
sense is also stable in the bounded-input, bounded-output sense.

If it's BIBO stable, then that means you can select your overflow level
to be just outside the output bounds (or your gain to _keep_ the output
bounds to just inside the overflow level).

Then you're OK.

--
www.wescottdesign.com
From: robert bristow-johnson on
On Dec 22, 10:53 pm, Tim Wescott <t...(a)seemywebsite.com> wrote:
> On Tue, 22 Dec 2009 20:50:42 -0600, Vladimir Vassilevsky wrote:
> > Tim Wescott wrote:
>
> >> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>
> >>>The dynamic range of a filter is limited by overflow at the top, and by
> >>>quantization artifacts at the bottom. We can try all variants of
> >>>assignment of poles and zeroes to different stages to maximize the
> >>>dynamic range from rms quantization noise to full scale sine wave at
> >>>the "worst" frequency. So far so good.
>
> >>>However, this doesn't tell if some stage of filter can overflow if the
> >>>input is an arbitrary non-harmonic waveform. How could we optimize the
> >>>filter for this case?
>
> >> So find the impulse response from input to each state, then sum the
> >> absolute values, then do the math.
>
....
>
> > 1. Find the impulse response of stage #1, set stage #1 gain accordingly..
> > 2. Find the impulse response of stages #1 + #2, set stage #2 gain
> > accordingly.
> > 3. Find the impulse response of stages #1 + #2 + #3, set stage #3 gain
> > accordingly.
>
> > So on, so forth. The system is guaranteed not to overflow for any input..
>
....
> I suppose the next step is to apportion the stages so that the gains can
> remain as high as possible without allowing overflow -- I'll bet that's
> not as trivial.

it's not a proof, but a sorta rule of thumb that i thought made sense
is to start with the pole pair (i'm gonna assume everything is complex
conjugate) that are the least stable; the poles closest to the unit
circle. group those poles with the pair of zeros that are closest to
the poles. that's your first section. strike that pole pair and zero
pair off the list and do it all over again for the next section and so
on.

r b-j

From: Tim Wescott on
On Tue, 22 Dec 2009 20:32:58 -0800, robert bristow-johnson wrote:

> On Dec 22, 10:53 pm, Tim Wescott <t...(a)seemywebsite.com> wrote:
>> On Tue, 22 Dec 2009 20:50:42 -0600, Vladimir Vassilevsky wrote:
>> > Tim Wescott wrote:
>>
>> >> On Tue, 22 Dec 2009 13:59:28 -0600, Vladimir Vassilevsky wrote:
>>
>> >>>The dynamic range of a filter is limited by overflow at the top, and
>> >>>by quantization artifacts at the bottom. We can try all variants of
>> >>>assignment of poles and zeroes to different stages to maximize the
>> >>>dynamic range from rms quantization noise to full scale sine wave at
>> >>>the "worst" frequency. So far so good.
>>
>> >>>However, this doesn't tell if some stage of filter can overflow if
>> >>>the input is an arbitrary non-harmonic waveform. How could we
>> >>>optimize the filter for this case?
>>
>> >> So find the impulse response from input to each state, then sum the
>> >> absolute values, then do the math.
>>
> ...
>>
>> > 1. Find the impulse response of stage #1, set stage #1 gain
>> > accordingly. 2. Find the impulse response of stages #1 + #2, set
>> > stage #2 gain accordingly.
>> > 3. Find the impulse response of stages #1 + #2 + #3, set stage #3
>> > gain accordingly.
>>
>> > So on, so forth. The system is guaranteed not to overflow for any
>> > input.
>>
> ...
>> I suppose the next step is to apportion the stages so that the gains
>> can remain as high as possible without allowing overflow -- I'll bet
>> that's not as trivial.
>
> it's not a proof, but a sorta rule of thumb that i thought made sense is
> to start with the pole pair (i'm gonna assume everything is complex
> conjugate) that are the least stable; the poles closest to the unit
> circle. group those poles with the pair of zeros that are closest to
> the poles. that's your first section. strike that pole pair and zero
> pair off the list and do it all over again for the next section and so
> on.
>
> r b-j

OTOH, leading with a more highly-damped pole pair would hinder energy
from getting through to overflow later stages.

--
www.wescottdesign.com