# Question on discrete signals and quantization

Suppose we have 2 different levels of a quantized signal.

Let's say that the range is $$[-1,1]$$. The number of bits necessary to encode these levels is$$\log_2(2) = 1$$. However if the value of the analog signal $$x(n)$$ is exactly equal to $$0$$, then can we choose freely to encode it as $$0$$ or $$1$$?

• The # of bits necessary to encode these leves are 2/(3−1), um, no, that's wrong. How did you arrive at that result? Commented Nov 8, 2022 at 15:13
• because the range is 2, range is 1-(-1) = 2 Commented Nov 8, 2022 at 15:14
• um, that makes no sense? there's three values in that range. And number of bits (i.e., information) isn't defined via a range? The formula you're using resembles nothing that I'd know (or which would make sense in this context, if you ask me). So please, edit your question and explain what that formula describes, and how the 2, the 3 and the 1 ended up in it. Commented Nov 8, 2022 at 15:16
• Do you mean that because quantizing with $m$ bits defines $M = 2^m$ levels, since you have $M = 2$ levels you need $m = 1$ bit?
– Jdip
Commented Nov 8, 2022 at 15:22
• @Jdip no I didnt understand it correctly , I looked my professor's note and I have editted my question Commented Nov 8, 2022 at 15:22

I think I understand what you're asking, but it depends on the quantization type, and your question lacks the details necessary to a definite answer.

However, in general, if you have an analog signal $$x(t)$$ that takes on values in a certain range, and a $$m$$-bit quantizer, your quantized (and sampled!) signal $$x[n]$$ can take on $$M = 2^m$$ values to represent the analog values within that range. This is done through a mapping operation. Which mapping is used depends on the quantizer.

For example, for an analog signal $$x(t)$$ in the range $$[-1, 1]$$, with $$m = 2$$ bits, the discrete signal $$x[n]$$ can take on $$M = 2^2 = 4$$ discrete values that could map to the analog values in the following ways:

\begin{align} &\text{4-bit representation} &\qquad &\text{1st mapping} &\qquad &\text{2nd mapping}\\ &\tt{11} &\qquad &0.5 &\qquad &0.75\\ &\tt{10} &\qquad &0 &\qquad &0.25\\ &\tt{01} &\qquad -&0.5 &\qquad -&0.25\\ &\tt{00} &\qquad -&1 &\qquad -&0.75\\ \end{align}

Let's look at the result $$x[n_0]$$ of these mappings on a couple analog values $$x(t_0)$$ and $$x(t_1)$$:

1. Analog value $$x(t_0) = 1$$:

• 1st mapping: $$x(t_0)$$ would be represented by $$\tt{11}$$ which maps to $$0.5$$ (round down).
• 2nd mapping: $$x(t_0)$$ would be represented by $$\tt{11}$$ which maps to $$0.75$$ (round down).
2. Analog value $$x(t_1) = 0$$:

• 1st mapping: $$x(t_1)$$ would be represented by $$\tt{10}$$ which maps to $$0$$ (round down).
• 2nd mapping: $$x(t_1)$$ would be represented by $$\tt{10}$$ which maps to $$0.25$$ (round up) or by $$\tt{01}$$ which maps to $$-0.25$$ (round down).