Talk:Quantization error

message: Trying to find a derivation for the quantization noise power equations and subsequent SNR per bit resolution values.  I can't find the type of derivation I am thinking of online.  Some scribbled, incoherent notes from class (I was probably asleep, and can't find the source I copied them from):
\sigma^2_{e_t} = 
          	Signed magnitude        	Two's complement
Truncation	5 \cdot 2^{-2b} \over 24	2^{-2b} \over 12
Round-off 	2^{-2b} \over 12        	2^{-2b} \over 12
\sigma^2_{e_t} = {5 \over 2} \sigma^2_{e_r}
LSB-1: \sigma^2_{e_l} = {2^{-2b} \over 3}
\sigma^2_{e_l} = 4 \sigma^2_{e_r}
----
Mean squared error or quantization noise
{1 \over \Delta} 	\int_{-\Delta/2}^{\Delta/2} \epsilon^2\, d \epsilon = {1 \over \Delta} \left( {\epsilon^3 \over 3} \right) \Bigg|_{-\Delta/2}^{\Delta/2} = {1 \over \Delta} \left( {\Delta^3 \over 8 \cdot 3} + {\Delta^3 \over 8 \cdot 3} \right) = {\Delta^2 \over 12}
with a note making sure I remember that it's not always Δ2/12.  The external link I included shows a more thorough derivation of q2/12.  — Omegatron 06:04, 17 October 2005 (UTC)
replies: text: Wonderful.  Thank you. — Omegatron 14:44, 6 December 2005 (UTC)
thread_title:  Derivation 

message: I have previously derived the SNR formulas in my thesis. Sorry for the unconventional symbols, i use Q for LSB (in volts) and N for the number of resolution bits and m=2^N for the number of levels. umax and umin are the max and min voltage corresponding to the quantized interval of Q*m
The noise power is assumed to be uniform:
P_\mathrm{noise}=\frac{1}{T}\int_{0}^{T}\left[(\frac{t}{T}-\frac{1}{2})Q\right]^{2}dt=2\int_{0}^{1/2}(tQ)^{2}dt=\frac{Q^{2}}{12}
where Q is the quantization step (often called LSB):
Q=\frac{u_\mathrm{max}-u_\mathrm{min}}{m}
In the case of a uniformly distributed signal (ramped, triangle etc) the signal power is
P_\mathrm{signal}^\mathrm{ramp}=\frac{1}{T}\int_{0}^{T}\left[(\frac{t}{T}-\frac{1}{2})(u_\mathrm{max}-u_\mathrm{min})\right]^{2}dt=\frac{(mQ)^{2}}{12}
where i use m=2^N for the number of levels (does not have to be a power of two!). And thus the SNR
\mathrm{SNR_{ramp}}=m^{2}=2^{2N}.
In decibels this is
\mathrm{SNR_{ramp}}[\textrm{dB}]=10\log_{10}(2^{2N})=2N\cdot10\log_{10}(2)=6.02N
Next case: A sine wave test tone. This one has more power than the ramped, namely:
P_\mathrm{signal}^\mathrm{sine}=\frac{1}{T}\int_{0}^{T}\left[\sin(2\pi\frac{t}{T})\frac{u_\mathrm{max}-u_\mathrm{min}}{2}\right]^{2}dt=\frac{(mQ)^{2}}{8}
And the SNR becomes
\mathrm{SNR_{sine}}=\frac{3}{2}m^{2}=\frac{3}{2}2^{2N}.
in decibels:
\mathrm{SNR_{sine}}[\textrm{dB}]=10\log_{10}(\frac{3}{2}2^{2N})=2N\cdot10\log_{10}(2)+10\log_{10}(3/2)=6.02N+1.76
/ Johan Stigwall
:Wonderful.  Thank you. — Omegatron 14:44, 6 December 2005 (UTC)
thread_title:  Thesis 

message: I think there is a discrepancy in the formula for sawtooth SNR and the example given. The formula is approximated as 6.02 · n, where n=4 for 16 bit audio. However, the example provided comes up with the answer 6.02 · 16 = 96.3 dB, which is not in agreement with the formula.
One stinky bum 01:35, 14 January 2007 (UTC)
thread_title:  Error In Example? 

message: Which of the following 4 formulas is the right way to calculate the quantization noise relative to a full-scale sinewave?
The "quantization noise" article currently gives the formulas
* 1 : \mathrm{SNR_{ADC}} = 20 \log_{10}(2^Q) \approx 6.02 \cdot Q\ \mathrm{dB} 
* 2 : \mathrm{SNR_{ADC}} =  \left ( 1.761 + 6.02 \cdot Q \right )\ \mathrm{dB} 
(Are those 2 formulas contradictory?)
The article
"Creating the Digital World: Step One"  by Rob Howald
gives a formula with one additional term
* 3 : SQNR (dB) = ( 6.02 N + 10 log [ fsample/ 2 fbandwidth] + 1.76 ) dB
(The formulas (2) and (3) would give the same answer in the case where fsample == 2 fbandwidth.)
Also, the SQNR page gives a formula that looks completely different:
* 4 : SQNR|_{dB}=P_{x^\nu}+6\nu+4.8
Which is the right way to calculate the quantization noise relative to a full-scale sinewave?
--68.0.120.35 01:05, 25 May 2007 (UTC)
thread_title:  the right formula 

message: I'm removing the first line of this article, which says that quantization error has to do with the conversion from PAM to PCM. If an analog signal is in a PAM form, there's already quantization error. --TedPavlic | talk 16:08, 18 February 2008 (UTC)
thread_title:  Why modulation? 

message: I would suggest translating the spanish version: Ruido de cuantificación. --213.37.235.41 (talk) 19:12, 2 May 2008 (UTC)
thread_title:  Spanish version 

message: The link to quantization noise redirect to itself ( = this page ). Since I'm not a regular wiki user I prefer just telling and letting someone "who knows" doing it 213.121.242.200 (talk) 22:46, 14 May 2008 (UTC)
thread_title:  Redirection 

message: The graphical representation of quantization error does not take into account how the digital signal is reconstructed. Quantization error is the difference between the reconstructed signal and the band limited original. --Kvng (talk) 19:20, 23 December 2010 (UTC)
replies: text: You are wrong, only offects sampling rate are affected by signal reconstruction. The example seems to use infinite sampling rate, so there is nothing to reconstruct. It is a bit misleading however, such signal is invalid, noise should be added prior to sampling.--90.179.235.249 (talk) 19:20, 19 February 2011 (UTC)
replies: text: I did assume a finite sample rate. I can see how the figure is correct for a system with infinite sample rate. Infinite sample rate is not practical so I'm not convinced that this is a good illustration. --Kvng (talk) 03:12, 20 February 2011 (UTC)
replies: text: It's an illustration of quantization error, not sample rate.--90.179.235.249 (talk) 23:21, 20 February 2011 (UTC)
thread_title:  Misleading figure