function [I,Q]=mod_QPSK(x);
  
% [I,Q]=mod_QPSK(x,modulation)
%
% QPSK modulation
% x : input bit stream
% [I,Q] : complex symbols
% x,I,Q are column vectors

i=sqrt(-1);

if rem(length(x),2)
    error('Length of input vector must be divisible with 2 for QPSK.');
end
y=(1-x(1:2:end)*2 + i*(1-x(2:2:end)*2))/sqrt(2);

I=real(y);
Q=imag(y);
