📄 qammodulation.m
字号:
function y = qammod(x,M, varargin)
%QAMMOD Quadrature amplitude modulation
% error checks
if(nargin>3)
error('comm:qammod:numarg','Too many input arguments.');
end
%Check x, ini_phase
if ( ~isreal(x) || any(any(ceil(x)~=x)) || ~isnumeric(x) )
error('comm:qammod:xreal','Elements of input X must be integers in [0, M-1].');
end
if(~isreal(M) || ~isscalar(M) || M<=0 || (ceil(M)~=M) || ~isnumeric(M) )
error('comm:qammod:Mreal','M must be a positive integer.');
end
if( ~isnumeric(M) || ceil(log2(M)) ~= log2(M))
error('comm:qammod:Mpow2','M must be in the form of M = 2^K, where K is an integer. ');
end
% check that X are all integers within range.
if (min(min(x)) < 0) || (max(max(x)) > (M-1))
error('comm:qammod:xreal','Elements of input X must be integers in [0, M-1].');
end
if(nargin==3)
ini_phase = varargin{1};
if(isempty(ini_phase))
ini_phase = 0;
elseif(~isreal(ini_phase) || ~isscalar(ini_phase) )
error('comm:qammod:ini_phaseReal','INI_PHASE must be a real scalar.');
end
else
ini_phase = 0;
end
const = squareqamconst(M,ini_phase);
y = genqammod(x,const);
% --- EOF --- %
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -