# Example exercise - Shannon's law on PCM-digitized signal

I am studying for a Digital Communications course in my university, and I am presented with the following example exercise.

You have a sound signal with spectral components in the 300-3000 Hz range. The signal is going to be digitised using Pulse Code Modulation.

a. For SNRdb == 30dB, what is the number of uniform quantum levels needed?

b. What is the minimum data transfer rate needed for the transmission of the digitized-with-PCM signal?

I know that for both of those questions I need to use Shannon's law, C = B*log_2(1+SNR) with SNRdb = 10*log10(SNR).

For task a. I need to find M, for task b. I need to find C.

My question: What do I use as B in both of the questions? How do I utilize the digitized-with-PCM info?

Do I take a median 1650Hz in a?

In b, do I write that PCM uses from 8 to 20something bits per sample, and use B = 20*3000Hz? Or do I just use the maximum B of the range, 3000?

Any help would be very much appreciated.

I know that for both of those questions I need to use Shannon's law, C = B*log_2(1+SNR) with SNRdb = 10*log10(SNR).

I'm not quite sure that's true. For the first question,

For SNRdb == 30dB, what is the number of uniform quantum levels needed?

quantization theory is pretty sufficient: In every digitally represented signal, there's so called quantization noise; it's nothing but the power in the difference between analog and quantized signal. For example, every additional bit in the ADC halves the size of the quantization step, reducing the average voltage error by one half, leading to four times less noise power (or, equivalently, 6dB better quantization noise).

So, this question, if you ask me, is: "When you need to achieve quantization noise better than 30dB, how large can your quantization levels be?".

Solution is relatively simple: Let $P_s$ be your signal power. Your Quantization-limited SNR is then

\begin{array} \mathrm{SNR}_Q &= \frac{P_s}{P_\text{quantization noise}} \end{array}

Without loss of generality, we set $P_s=1$. Hence, with $q$ the number of quantization steps and 1 the overall ADC range,

\begin{array}\\ {\mathrm{SNR}_Q}^{-1} &= {P_\text{quantization noise}}\\ &= E\left[\left(x_\text{digital} - x_\text{real}\right)^2\right]\\ &= \text{var}({e_Q})\text{, }e_Q\text{ being the quantization noise Random Variable (RV),}\\ &= \int\limits_{-\frac1{2q}}^\frac1{2q}{\left({e_Q}^2q \right)d{e_Q}}\text{, since variance of a uniform RV over }[-\frac1{2q}; \frac1{2q}]\text{ is known,}\\ &= q \left[ \frac13 {e_Q}^3 \right]_{-\frac1{2q}}^\frac1{2q}+C\\ &= \frac q{3}\left(\left(\frac1{2q}\right)^3 -\left(-\frac1{2q}\right)^3 \right)+0\text{, }C\text{ being zero because of plausability}\\ &= \frac q3\left(\frac1{8q^3}+\frac1{8q^3}\right)\\ &= \frac q3\frac1{4q^3}\\ &= \frac1{12} q^{-2}\\ &\overset!\le {30\text{dB}}^{-1}\\ &=\frac1{1000}\\ &\iff\\ q^2&\ge \frac{1000}{12}\\ &\iff\\ q&\ge \sqrt{\frac{500}6}\\ q&\ge 9.1\text{something}\\ q&\ge \left\lceil{9.1}\right\rceil \\ &=10 \end{array}

assuming that the ADC is perfectly linear and thus has absolutely uniform quantization noise for a signal that has uniformly distributed power over the whole ADC range, and thus, the error is uniformly distributed over the quantization step of size $\frac1q$.

That was fun.

b. What is the minimum data transfer rate needed for the transmission of the digitized-with-PCM signal?

Ha, Shannon, here we come.

PCM means we can't trick around with undersampling. So, our signal's bandwidth is 3kHz, meaning we need to sample with 6kHz. Every sample has information $I=-\log_2(P(x))$, $P(x)$ being the probability that value x is represented in the sample. Still assuming the signal is uniformly distributed (the assignment did not say it was a sum of sinusoids or similar!), $P$ is constant, $P=\frac1q$, hence $H(X)[\text{bit}]= -\log_2{\frac1{10}}= \frac{-\log_{10}{\frac1{10}}}{\log_{10} 2}=\frac1{0.3\dots}\approx 3.32\text b$.

So the bandwidth (bitrate) we need to transport is

\begin{align} r_b &= 3.32\text b \cdot 6 \text{kHz}\\ &= 19.93\frac{\text{kb}}{\text s}\text{ .} \end{align}

So with approximately 20kb/s, you can do it.

Those are very good questions. I'd like to ask you to post your own answer if you get an official solution, of course only after getting an O.K. from the professor/lecturer/TA to share his intellectual property (maybe pointing him to this would help). (I of course still like if you accept and upvote this one. It could also certainly use some improvement/corrections!)