Main Content

comm.GeneralQAMModulator

Modulate using arbitrary QAM constellation

Description

The comm.GeneralQAMModulator System object™ uses the general quadrature amplitude modulation (QAM) method to modulate a signal.

To modulate a signal by using the general QAM method:

  1. Create the comm.GeneralQAMModulator object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

gqamMod = comm.GeneralQAMModulator creates a general QAM modulator System object, gqamMod. This object applies the general QAM method to an input signal.

gqamMod = comm.GeneralQAMModulator(const) sets the Constellation property to const.

gqamMod = comm.GeneralQAMModulator(___,Name=Value) sets properties using one or more optional name-value arguments in addition to any of the input argument combinations in the previous syntaxes. For example, OutputDataType="double" sets the data type of the output to "double".

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Signal constellation, specified as a vector that lists the points in the signal constellation. The length of the constellation vector determines the modulation order.

Data Types: double
Complex Number Support: Yes

Data type of the output, specified as "double", "single", or "Custom".

Fixed-Point Properties

Fixed-point data type of the output, specified as a numerictype (Fixed-Point Designer) object with a signedness of Auto.

Dependencies

To enable this property, set the OutputDataType property to "Custom".

Usage

Description

Y = gqamMod(X) applies the general QAM to the input signal, X, and returns the baseband general quadrature amplitude modulated signal, Y.

example

Input Arguments

expand all

Input data, specified as an nonnegative integer or nonnegative integer-valued column vector. The values must be integers in the range [0, M−1], where M represents the number of points in the signal constellation. The data type of the input can be numeric or an unsigned fixed point of word length ceil(log2(ModulationOrder)) (fi object).

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fi

Output Arguments

expand all

Baseband quadrature amplitude modulated signal, returned as a scalar or column vector.

Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics

Examples

collapse all

Modulate and demodulate data using an arbitrary three-point constellation.

Define a three-point constellation for general quadrature amplitude modulation (QAM).

const = [1 1i -1];

Create general QAM modulator and demodulator System objects with the defined constellation.

gqamMod = comm.GeneralQAMModulator (const);
gqamdemod = comm.GeneralQAMDemodulator (const);

Create an error rate calculator.

errorRate = comm.ErrorRate
errorRate = 
  comm.ErrorRate with properties:

        ReceiveDelay: 0
    ComputationDelay: 0
             Samples: 'Entire frame'
      ResetInputPort: false

Run a loop to process frames of data by follwing these steps:

  1. Generate a random sequence of symbols.

  2. Modulate the random data to produce quadrature amplitude modulated symbols.

  3. Transmit the modulated symbols through the additive white Gaussian noise (AWGN) channel.

  4. Demodulate the received noisy symbols back to original data.

  5. Compute error statistics between transmitted and received data.

for counter = 1:100
     data = randi([0 2],50,1);
     modSignal = gqamMod(data);
     noisySignal = awgn(modSignal,5);
     receivedData = gqamdemod(noisySignal);
     errorStats = errorRate(data,receivedData);
end

Output the error rate and number of errors.

fprintf("Error rate = %f\nNumber of errors = %d\n", ...
      errorStats(1), errorStats(2))
Error rate = 0.045200
Number of errors = 226

Algorithms

The general QAM modulation algorithm comprises these steps:

  1. Define the signal constellation as a vector, where the length of the vector, M, represents the number of points in the signal constellation. Each point corresponds to a unique symbol.

  2. Input a signal as a scalar or column vector. The signal values must be integers in the range [0, M−1].

  3. Map the input integer m to the (m+1)st element in the constellation vector.

Extended Capabilities

Version History

Introduced in R2012a