y = qammod(___,Name,Value)
specifies options using name-value pair arguments in addition to any of the
input argument combinations from previous syntaxes.
Demodulate a fixed-point QAM signal and verify that the data is recovered correctly.
Set the modulation order as 64, and determine the number of bits per symbol.
M = 64;
bitsPerSym = log2(M);
Generate random bits. When operating in bit mode, the length of the input data must be an integer multiple of the number of bits per symbol.
x = randi([0 1],10*bitsPerSym,1);
Modulate the input data using a binary symbol mapping. Set the modulator to output fixed-point data. The numeric data type is signed with a 16-bit word length and a 10-bit fraction length.
y = qammod(x,M,'bin','InputType','bit','OutputDataType', ...
numerictype(1,16,10));
Demodulate the 64-QAM signal. Verify that the demodulated data matches the input data.
z = qamdemod(y,M,'bin','OutputType','bit');
s = isequal(x,double(z))
x — Input signal scalar | vector | matrix | 3-D array
Input signal, specified as a scalar, vector, matrix, or 3-D array. The
elements of x must be binary values or integers that range from 0 to
(M – 1), where M is the
modulation order.
Note
To process input signal as binary elements, set the
'InputType' name-value pair to
'bit'. For binary inputs, the number of rows must
be an integer multiple of log2(M). Groups of log2(M) bits are mapped onto a symbol, with the first bit
representing the MSB and the last bit representing the LSB.
Data Types: double | single | fi | int8 | int16 | uint8 | uint16
M — Modulation order scalar integer
Modulation order, specified as a power-of-two scalar integer. The
modulation order specifies the number of points in the signal
constellation.
Example: 16
Data Types: double
symOrder — Symbol order 'gray' (default) | 'bin' | vector
Symbol order, specified as 'gray',
'bin', or a vector.
Vectors must use unique elements whose values range from 0 to
M – 1. The first element corresponds to the
upper-left point of the constellation, with subsequent elements running down
column-wise from left to right.
Example: [0 3 1 2]
Data Types: char | double
Name-Value Pair Arguments
Specify optional
comma-separated pairs of Name,Value arguments. Name is
the argument name and Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Example: y =
qammod(x,M,symOrder,'InputType','bit')
'InputType' — Input type 'integer' (default) | 'bit'
Input type, specified as the comma-separated pair consisting of
'InputType' and either
'integer' or 'bit'. If you
specify 'integer', the input signal must consist of
integers from 0 to M – 1. If you specify
'bit', the input signal must contain binary
values, and the number of rows must be an integer multiple of log2(M).
Data Types: char
'UnitAveragePower' — Unit average power flag false or
0 (default) | true or 1
Unit average power flag, specified as the comma-separated pair
consisting of 'UnitAveragePower' and a numeric or
logical 0 (false) or
1 (true). When this flag is
1 (true), the function scales
the constellation to the average power of one watt referenced to 1 ohm.
When this flag is 0 (false), the
function scales the constellation so that the QAM constellation points
are separated by a minimum distance of two.
'OutputDataType' — Output data type numerictype object
Output data type, specified as the comma-separated pair consisting of
'OutputDataType' and a
numerictype object.
For more information on constructing these objects, see numerictype (Fixed-Point Designer). If you
do not specify 'OutputDataType', data type is
double if the input is of data type
double or built-in integer and
single if the input is of data type
single.
'PlotConstellation' — Option to plot constellation false or
0 (default) | true or 1
Option to plot constellation, specified as the comma-separated pair
consisting of 'PlotConstellation' and a numeric or
logical 0 (false) or
1 (true) To plot the QAM
constellation, set 'PlotConstellation' to
true.
y — Modulated signal scalar | vector | matrix | 3-D array
Modulated signal, returned as a complex scalar, vector, matrix, or 3-D
array of numeric values. For integer inputs, output y
has the same dimensions as input signal x. For bit
inputs, the number of rows in y is the number of rows
in x divided by log2(M).
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.