Professional Documents
Culture Documents
Experiment-1: Quantization
22-01-2020
Steps:
1. Write a function for quantizing a given signal and finding the SNR.
The function takes the signal vector x and the peak value A as inputs.
Perform the following steps for number of bits N from 1 to 8:
2A
(a) Find ∆ = 2N
.
∆ ∆
(b) Find the set of representation values: {−A + 2
:∆:A− 2
}.
(c) Obtain the quantized signal xq by approximating the x values with
the nearest representation value. (You can do this efficiently by
using the round instruction).
(d) Find the SNR. You can use 20*log10(norm(x)/(norm(x-xq)))
2. Let X be a uniform r.v over the range [−10, 10]. Generate 10000 re-
alizations and quantize them. Plot SNR vs. N . (Note that rand in
MATLAB returns uniform r.v values over [0, 1]. You need to scale and
shift appropriately to obtain the required range).
3. Repeat the above step for gaussian r.v with mean 0 and variance 1.
Select A = 4. Plot the SNR vs. N and compare with the uniform case.