2

I have a signal that has complex normal distribution with mean 0 and variance of 1. I want to quantize it with a uniform quantizer to 512 levels. I am generating the signal in MATLAB in the following way-

s = sqrt(0.5).*(randn(1,numBits) + 1i*randn(1,numBits));

I am quantizing the signal in the range(-1,1) with 512 levels in the following way:

min = -1;

max = 1;

q = (max-min)/2^9;

quantSignal = round(s/q)*q;

Is it a correct way of quantizing such a signal? I would appreciate any input on this.

Filipe Gonçalves
  • 20,783
  • 6
  • 53
  • 70
rmb
  • 1,737
  • 4
  • 14
  • 20
  • Is quantization a well-defined thing? If you know what you want to achieve, you should be able to determine whether your solution is correct. Syntactically speaking, what you wrote is reasonable. Maybe you can elaborate on why it could *not* be the "correct way of quantizing such a signal". – Andras Deak -- Слава Україні Sep 25 '15 at 11:09
  • Well I thought that the quantization interval (-1,1) might not be sufficient to properly quantize the signal s. Since I am new to this field of signal processing I thought of gaining feedback on this! And hence I posted this question! – rmb Sep 25 '15 at 12:16
  • OK, in this case I'l let the signal-processing guys tackle this:P If it's strongly related to signal processing, consider adding a corresponding tag (quantization is a small and vague tag). As a layman, I'd think that normal data are strongly clustered around 0, with few points far away. So: is logarithmic quantization a thing? – Andras Deak -- Слава Україні Sep 25 '15 at 12:18
  • ok I will add the tag :) – rmb Sep 25 '15 at 14:55

1 Answers1

1

The quantization formula you are using will map input values to a quantized version. However it will not limit the result to only 512 levels since your input signal can exceed the [-1,+1] range and you are not doing anything to limit the quantizer output (or input for that matter).

To limit the values you can use min and max built-in functions. However since they work with the modulus for complex number, you'll have to split the numbers into their real and imaginary parts first. So, quantizing complex numbers with real and imaginary parts each constrained within the range [minValue,maxValue] can be done with:

q = (maxValue-minValue)/(2^9-1);
realPart = min(max(real(s),minValue),maxValue);
realPart = minValue + round((realPart-minValue)/q)*q;
imagPart = min(max(imag(s),minValue),maxValue);
imagPart = minValue + round((imagPart-minValue)/q)*q;
quantSignal = realPart + j*imagPart;

I mentioned earlier that your normal signal with unit variance will in general not be restricted to the [-1,1] range (or to any range for that matter). It is thus common to try to minimize a measure of quantization error such as a mean squared error (the expected value of the squared difference between the unquantized input and the corresponding quantized output).

For a uniform quantizer and given specific signal characteristics (in this case a complex Gaussian signal) this mean squared error is a function of the number of quantization levels and the quantizer's input range. For 512 levels, the real and imaginary parts should ideally be within approximately +/- 4.2 standard deviations. Since your standard deviation is sqrt(0.5) for the real and imaginary parts, this can be achieved with

maxValue = 4.2*sqrt(0.5);
minValue = -maxValue;

Should you need the real and imaginary part of your quantized output to be constrained to a specific range, then you may apply a scaling factor at the output of the quantizer (e.g. divide by 4.2*sqrt(0.5) to get the real and imaginary part constrained to [-1,+1]).

SleuthEye
  • 14,379
  • 2
  • 32
  • 61
  • thank you for your useful input. However I would like to know how you obtained +/- 4.2 for 512 levels. – rmb Sep 27 '15 at 10:40
  • Essentially compute the mean squared error through sum(integral((x-level(i))^2 pdf(x))) for different values of `maxValue`, plot and find the minimum. – SleuthEye Sep 27 '15 at 11:35
  • I have observed that after defining the quantizer range from [-4.2*sqrt(0.5),4.2*sqrt(0.5)] the original signal is clipped. If I increase the range of the quantizer, the problem of clipping is gone. Is there a way to calculate the quantization range to avoid clipping of original signal? – rmb Sep 29 '15 at 09:23
  • Gaussian signals have an infinite range, which means you will always get a little bit of clipping. The larger the range then the less probable the clipping (but it never fully goes away). However with limited number of levels, a larger range also means larger quantization steps which results in more quantization error. `+/- 4.2*sqrt(0.5)` for 512 levels strike a balance (in the mean squared error sense) between the error introduced by clipping and the quantization error within the quantizer output range. – SleuthEye Sep 29 '15 at 12:13
  • quite helpful! Any idea on how I could find the number of clipped symbols? Is this the correct way: indices=find(real(s)>q); numClipped = length(indices); – rmb Sep 29 '15 at 15:41
  • 1
    almost. `q` is your step size, whereas you should be detecting anything more than half the total range from the center. Also a clipped symbol is generally one that has either real or imaginary part clipped (but if real&imag part are clipped you shouldn't count it twice). So: `mu=0.5*(minValue+maxValue); halfrng=0.5*(maxValue-minValue)`; numClipped=length(union(find(abs(real(s)-mu)>halfrng), find(abs(imag(s)-mu)>halfrng));` – SleuthEye Sep 29 '15 at 16:28