%===================================================================
% E. BOUTILLON
% 21/06/2013
% Generation of the 8-PSK modulation
%===================================================================
coord = (1:8);
constellation = exp(2*pi*1i*coord/8);
plot(constellation,'rd');

theta = (1:100);
circle = exp(2*pi*1i*theta/99);

%===================================================================
% Quantization of the Polar_quantized_LLR value.
%===================================================================
k=1;
for rau = 0:31
    for theta = 0:31
        grid_polar(k)     = (rau)/10*exp( 1i*2*pi*(theta-1)/32);
        k = k+1;
    end
end

k=1;
for I = -31:2:31
    for J = -31:2:31
        grid_IQ(k)     = I/10 + 1i*J/10;
        k = k+1;
    end
end


coord = (1:8);
constellation = exp(2*pi*1i*coord/8);

figure(1);
plot(constellation,'r*');
hold on;
plot(circle);
grid on;
plot(real(grid_polar),imag(grid_polar),'.');
xlabel('I');
ylabel('Q');
title('Polar quantization grid');

figure(2);
plot(constellation,'r*');
hold on;
grid on;
plot(circle);
plot(real(grid_IQ),imag(grid_IQ),'.');
xlabel('I');
ylabel('Q');
title('IQ quantization grid');

