# snr of quantizer using fixed logic

Started by February 22, 2008
```Hello all,

I am doing SNR measurement of 8 bit quantizer
implemented using "fix" logic (flooring towards
zero for both + and - numbers).

i am doing time domain and frequency domain
estimation.

TSNR = 43.6 dB (correct value).
FSNR = 48.0 dB (in-correct value).

for all other quantizers like round, floor and ceil,
i get the same number for TSNR and FSNR.

Any idea as to why I get more then required (4.4db)
extra SNR for quantizer using fix logic, and when
I do frequency domain estimation.

I have taken care of windowing of data, using blackman
harris 11Term. Also I see harmonic distortion in FFT
plot. Despite of this I am getting a better SNR number
if I do frequency domain measurement.

Regards
Bharat Pathak

Arithos Designs
www.Arithos.com
```
```"bharat pathak" <bharat@arithos.com> writes:

> Hello all,
>
>       I am doing SNR measurement of 8 bit quantizer
>       implemented using "fix" logic (flooring towards
>       zero for both + and - numbers).
>
>       i am doing time domain and frequency domain
>       estimation.

Hi Bharat,

Can you tell us more precisely what you are doing in each of these
domains to obtain the estimate?
--
%  Randy Yates                  % "How's life on earth?
%% Fuquay-Varina, NC            %  ... What is it worth?"
%%% 919-577-9882                % 'Mission (A World Record)',
%%%% <yates@ieee.org>           % *A New World Record*, ELO
http://www.digitalsignallabs.com
```
```>Can you tell us more precisely what you are doing in each of these
>domains to obtain the estimate?

Hello Randy,

For time domain measurement I am using the formula:

SP = mean(x(n) .^ 2);
NP = mean(e(n) .^ 2);   % [e(n) = x(n) - xq(n)] is the quantizer error

TSNR = 10*log10(SP/NP);

%---------------------------------------------------------------------

For freq domain, I first window the data using blackmanharris
11 Term equation. after that I use parsevals equation for power
calculation

P = sum(abs(X(k)) .^ 2);

for signal power I compute only for bins : kin-delta to kin + delta
where delta = 11. This is found from plotting the mag resp of window
in log domain.

for noise power i compute, NP1 from k = 0 : kin-delta
and  NP2 from k = kin+delta : N/2

Since I am calculating signal power for only 1 spike in freq domain
hence I am summing only upto N/2 for calculating noise power NP2.

NP = NP1 + NP2

again use FSNR = 10*log10(SP/NP)

FSNR is able to measure correctly for rnd, floor and ceil quantizers.
But only for "fix" quantizer it is giving wrong answer. So want to
find out why?

Thanks and Regards
Bharat Pathak

Arithos Designs
www.Arithos.com

```
```bharat pathak wrote:
> Hello all,
>
>       I am doing SNR measurement of 8 bit quantizer
>       implemented using "fix" logic (flooring towards
>       zero for both + and - numbers).
>
>       i am doing time domain and frequency domain
>       estimation.
>
>       TSNR = 43.6 dB (correct value).
>       FSNR = 48.0 dB (in-correct value).
>
>       for all other quantizers like round, floor and ceil,
>       i get the same number for TSNR and FSNR.
>
>       Any idea as to why I get more then required (4.4db)
>       extra SNR for quantizer using fix logic, and when
>       I do frequency domain estimation.
>
>       I have taken care of windowing of data, using blackman
>       harris 11Term. Also I see harmonic distortion in FFT
>       plot. Despite of this I am getting a better SNR number
>       if I do frequency domain measurement.

This doesn't answer your question, but it bears on it. Truncating toward
zero creates a discontinuity around zero.* That discontinuity amounts to
center clipping and might account for the distortion.

Jerry
____________________________________________________________
* Consider this sequence and its truncation:

-3.0 -2.5 -2.0 -1.5 -1.0 -0.5  0.0  0.5  1.0  1.5  2.0  2.5  3.0
-3   -2   -2   -1   -1    0    0    0    1    1    2    2    3
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```