On May 16, 12:56*am, "Green Xenon [Radium]" <
[email protected]>
wrote:
> Is there any modulation scheme that does
> the opposite -- i.e. the two carrier waves have only two amplitudes but
> with more than two phases?
Star QAM.
Darrell
function y = starqam16(d, r, mode)
%
%STARQAM16 Quadrature Amplitude Modulation with 16 point star shaped
% constellation as opposed to traditional square shaped. A
% star shaped constellation is essentially a set of
concentric
% PSK rings. For a 16 symbol constellation, there are two
% PSK rings with 8 symbols per ring.
%
% The primary benfit of a star constellation versus a square
% constellation is that, with differential encoding, there
is
% no need for pilot assistance in a faded envrionment. The
% least significant bit selects the outer (1) or inner ring
(0),
% and a gray coding scheme is used on each ring. The exact
% mapping is given by:
%
% 000 - 0 degree phase shift
% 100 - 45 degree phase shift
% 101 - 90 degree phase shift
% 111 - 135 degree phase shift
% 110 - 180 degree phase shift
% 010 - 225 degree phase shift
% 011 - 270 degree phase shift
% 001 - 315 degree phase shift
%
% y = starqam16(d, r, mode)
%
% r and mode are optional arguements. r specifies the
% inner/outer ring ratio and defaults to 1.8. mode
specifies
% either 'modulation' or 'demodulation.' By default, the
% function checks to see if the input matrix is real or
% imaginary and chooses mode = 'modulate' or mode =
% 'demodulate', respectively.
%
j = sqrt(-1);
% Parse parameters.
if (nargin < 1)
error('\nNot enough input arguments!\n');
end
if (nargin == 1)
r = 1.8;
if isreal(d)
mode = 'modulate';
else
mode = 'demodulate';
end
end
if (nargin == 2)
if isreal(d)
mode = 'modulate';
else
mode = 'demodulate';
end
end
if (nargin > 3)
error('\nToo many input arguments!\n');
end
if (nargout > 1)
error('\nToo many output arguments!\n');
end
row(d);
%%%%%%%%%%%%%%
% Demodulate %
%%%%%%%%%%%%%%
if (strcmp(mode,'demodulate') == 1)
% Calculate phase difference with hard decision slicing
phi = angle(d) - cat(2, 0, angle(d(1:length(d)-1)));
phi(find(phi<0)) = 2*pi + phi(find(phi<0));
sliced_phi = mod(quant(phi,pi/4), 2*pi);
p = [ 0 % 000 - 0 degree phase shift
4 % 001 - 315 degree phase shift
5 % 010 - 225 degree phase shift
7 % 011 - 270 degree phase shift
6 % 100 - 45 degree phase shift
2 % 101 - 90 degree phase shift
3 % 110 - 180 degree phase shift
1 ]; % 111 - 135 degree phase shift
y = 2*p((4/pi)*sliced_phi + 1);
% Calculate magnitude difference with hard decision slicing
A = abs(d) - cat(2, 1, abs(d(1:length(d)-1)));
y(find(abs(A)>(r-1)/2)) = y(find(abs(A)>(r-1)/2)) + 1;
%%%%%%%%%%%%%%
% Modulate %
%%%%%%%%%%%%%%
elseif (strcmp(mode,'modulate') == 1)
p = [ 0*pi/4 % 000 - 0 degree phase shift
7*pi/4 % 001 - 315 degree phase shift
5*pi/4 % 010 - 225 degree phase shift
6*pi/4 % 011 - 270 degree phase shift
1*pi/4 % 100 - 45 degree phase shift
2*pi/4 % 101 - 90 degree phase shift
4*pi/4 % 110 - 180 degree phase shift
3*pi/4 ]; % 111 - 135 degree phase shift
input_bits = dec2bin(d, 4);
radius = (r-1)*mod(cumsum(bin2dec(input_bits(:,4))),2) + 1;
phase = mod(cumsum(p(1+bin2dec(input_bits(:,1:3)))),2*pi);
y = radius .* exp(j*phase);
else
error(sprintf('\nUnsupported mode %s\n', mode));
end