Pre-ci test passed git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4000 818b1a75-f10b-46b9-bf7c-635c3b92a50f
36 lines
669 B
Matlab
Executable File
36 lines
669 B
Matlab
Executable File
function [q_out] = quantize_q (q_in)
|
|
|
|
% q_in must be a complex number.
|
|
|
|
if (real(q_in) > 0)
|
|
if (imag(q_in) > 0)
|
|
if (abs(real(q_in)) > abs(imag(q_in)))
|
|
q_out = 1;
|
|
else
|
|
q_out = 1i;
|
|
end
|
|
else
|
|
if (abs(real(q_in)) > abs(imag(q_in)))
|
|
q_out = 1;
|
|
else
|
|
q_out = -1i;
|
|
end
|
|
end
|
|
else
|
|
|
|
if (imag(q_in) > 0)
|
|
if (abs(real(q_in)) > abs(imag(q_in)))
|
|
q_out = -1;
|
|
else
|
|
q_out = 1i;
|
|
end
|
|
else
|
|
if (abs(real(q_in)) > abs(imag(q_in)))
|
|
q_out = -1;
|
|
else
|
|
q_out = -1i;
|
|
end
|
|
end
|
|
end
|
|
|