1 ## Copyright (C) 2007 Sylvain Pelissier <sylvain.pelissier@gmail.com>
2 ## Copyright (C) 2009 Christian Neumair <cneumair@gnome.org>
4 ## This program is free software; you can redistribute it and/or modify it under
5 ## the terms of the GNU General Public License as published by the Free Software
6 ## Foundation; either version 3 of the License, or (at your option) any later
9 ## This program is distributed in the hope that it will be useful, but WITHOUT
10 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 ## You should have received a copy of the GNU General Public License along with
15 ## this program; if not, see <http://www.gnu.org/licenses/>.
18 ## @deftypefn {Function File} qamdemod (@var{x},@var{m})
19 ## Create the QAM demodulation of x with a size of alphabet m.
20 ## @seealso{qammod,pskmod,pskdemod}
23 function z = qamdemod(y,m)
25 usage('y = qamdemod(x,m)');
30 if(c ~= fix(c) || log2(c) ~= fix(log2(c)))
31 error('m must be a square of a power of 2');
34 x = qammod(0:(m-1),m);
38 [n z(k)] = min(abs(y(k) - x));