# Scaling Coefficients to unity peak

Started by May 22, 2015
```I had this exercise to design a filter using the remez algorithm in matlab
and without coefficient scaling I quantized them to N bits  and then
scaled them to unity peak and compared these spectrums to each other. The
spectrum without scaling did not meet specifications for stop band
attenuation while the scaled did.

I get that scaling the coefficients maximizes the value range the
coefficients can take on in a actual processing system which in turn
minimizes quantization noise error, i assume. But this conclusion doesn't
quit feel comfortable to me, or intuitive, can someone perhaps elaborate
on this further?

---------------------------------------
Posted through http://www.DSPRelated.com
```
```Matlab filter design functions target unity dc gain i.e. sum of coeffs =
1.
naturally best performance is with floating point. If you quantise it to n
bits with sum still equal unity (i.e. 2^(n-1)) then you are likely to use
less than available resolution but you can achieve unity by just
discarding n lsbs from sum of products.

If you target scaling so that peak is at maximum resolution then you lose
unity gain and you may need multiplier to get unity back. If you are not
concerned about unity gain then maximum peak resolution is naturally best
for filtering quality.

Notice also some small side coeffs (and others) may actually become zero
depending on scaling.

Kaz

---------------------------------------
Posted through http://www.DSPRelated.com
```
```On Fri, 22 May 2015 17:26:53 -0500, "spetcavich" <104485@DSPRelated>
wrote:

>I had this exercise to design a filter using the remez algorithm in matlab
>and without coefficient scaling I quantized them to N bits  and then
>scaled them to unity peak and compared these spectrums to each other. The
>spectrum without scaling did not meet specifications for stop band
>attenuation while the scaled did.
>
>I get that scaling the coefficients maximizes the value range the
>coefficients can take on in a actual processing system which in turn
>minimizes quantization noise error, i assume. But this conclusion doesn't
>quit feel comfortable to me, or intuitive, can someone perhaps elaborate
>on this further?

As you've seen, and guessed, as you reduce the coefficient magnitudes
with a fixed-point representation, the quantization noise in the
coefficients goes up.   As kaz pointed out, if you keep reducing them,
eventually some of the smaller coefficients will go to zero.  So the
net effect is that you get a slightly different impulse response every
time you increase the quantization noise of the coefficients, and the
frequency response of the filter changes accordingly.

Eric Jacobsen
Anchor Hill Communications
http://www.anchorhill.com
```
```On Friday, May 22, 2015 at 6:26:57 PM UTC-4, spetcavich wrote:
> I had this exercise to design a filter using the remez algorithm in matlab
> and without coefficient scaling I quantized them to N bits  and then
> scaled them to unity peak and compared these spectrums to each other. The
> spectrum without scaling did not meet specifications for stop band
> attenuation while the scaled did.
>
> I get that scaling the coefficients maximizes the value range the
> coefficients can take on in a actual processing system which in turn
> minimizes quantization noise error, i assume. But this conclusion doesn't
> quit feel comfortable to me, or intuitive, can someone perhaps elaborate
> on this further?
>
>
> ---------------------------------------
> Posted through http://www.DSPRelated.com

A drawback to scaling up is more potential problems dealing with overflow or saturation. Also max scaling in the positive direction has to be to just less than 1, since 1 is not representable in fractional format. 2^(n-1)-1 is the max positive coefficient possible.

Dirk
```