Example exercise - Shannon's law on PCM-digitized 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).


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 &amp;= \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} &amp;= {P_\text{quantization noise}}\\
&amp;= E\left[\left(x_\text{digital} - x_\text{real}\right)^2\right]\\
&amp;= \text{var}({e_Q})\text{, }e_Q\text{ being the quantization noise Random Variable (RV),}\\
&amp;= \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,}\\
&amp;= q \left[ \frac13 {e_Q}^3 \right]_{-\frac1{2q}}^\frac1{2q}+C\\
&amp;= \frac q{3}\left(\left(\frac1{2q}\right)^3 -\left(-\frac1{2q}\right)^3  \right)+0\text{, }C\text{ being zero because of plausability}\\
&amp;= \frac q3\left(\frac1{8q^3}+\frac1{8q^3}\right)\\
&amp;= \frac q3\frac1{4q^3}\\
&amp;= \frac1{12} q^{-2}\\
&amp;\overset!\le {30\text{dB}}^{-1}\\
&amp;=\frac1{1000}\\
&amp;\iff\\
q^2&amp;\ge \frac{1000}{12}\\
&amp;\iff\\
q&amp;\ge \sqrt{\frac{500}6}\\
q&amp;\ge 9.1\text{something}\\
q&amp;\ge \left\lceil{9.1}\right\rceil \\
&amp;=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 &amp;= 3.32\text b \cdot 6 \text{kHz}\\
&amp;= 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!)