1 ## Copyright (C) 2006 Charalampos C. Tsimenidis
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{y} =} genqammod (@var{x}, @var{c})
19 ## Modulates an information sequence of intergers @var{x} in the range
20 ## @code{[0 @dots{} M-1]} onto a quadrature amplitude modulated signal
21 ## @var{y}, where @code{M = length(c) - 1} and @var{c} is a 1D vector
22 ## specifing the signal constellation mapping to be used. An example of
23 ## combined 4PAM-4PSK is
27 ## d = randint(1,1e4,8);
28 ## c = [1+j -1+j -1-j 1-j 1+sqrt(3) j*(1+sqrt(3)) -1-sqrt(3) -j*(1+sqrt(3))];
29 ## y = genqammod(d,c);
35 ## @seealso{genqamdemod}
37 function y=genqammod(x,c)
40 usage("y = genqammod (x, c)");
44 if ~isempty(find(ismember(x,m)==0))
45 error("x elements should be integers in the set [0, length(c)-1].");
50 %!assert(genqammod([0:7],[-7:2:7]),[-7:2:7])
51 %!assert(genqammod([0:7],[-7 -5 -1 -3 7 5 1 3]),[-7 -5 -1 -3 7 5 1 3])