- https://www.mathworks.com/help/comm/release-notes.html?startrelease=R2021b&endrelease=R2024b&rntext=comm.RectangularQAMModulator&groupby=release&sortby=descending&searchHighlight=comm.RectangularQAMModulator#:~:text=comm.RectangularQAMModulator%20and%20comm.RectangularQAMDemodulator%20System%20objects%20have%20been%20removed
- https://www.mathworks.com/help/releases/R2022b/comm/ref/qammod.html
Why do I receive "Error using RectangularQAMModulator"
27 views (last 30 days)
Show older comments
% Set the OFDM and QAM parameters
N = 64; % Number of subcarriers
M = 16; % Size of QAM constellation
CP = 16; % Cyclic prefix length
% Set the number of nodes in the network
numNodes = 4;
% Set the frame length and number of slots
frameLength = 1000;
numSlots = numNodes;
% Create an OFDM modulator object
ofdmMod = comm.OFDMModulator('FFTLength', N, 'NumGuardBandCarriers', [0;0], 'CyclicPrefixLength', CP);
% Create an OFDM demodulator object
ofdmDemod = comm.OFDMDemodulator('FFTLength', N, 'NumGuardBandCarriers', [0;0], 'CyclicPrefixLength', CP);
% Create a QAM modulator object
qamMod = comm.RectangularQAMModulator('ModulationOrder', M, 'NormalizationMethod', 'Average power');
% Create a QAM demodulator object
qamDemod = comm.RectangularQAMDemodulator('ModulationOrder', M, 'NormalizationMethod', 'Average power');
% Generate a random data sequence for each node
data = randi([0 M-1], frameLength, numNodes);
% Modulate the data using QAM
modData = qamMod(data);
% Modulate the QAM symbols using OFDM
txSignal = ofdmMod(modData);
% Perform DCT on the OFDM symbols
txSignal = dct(txSignal);
% Create a TDMA schedule
schedule = repmat((1:numNodes)', 1, frameLength/numSlots);
schedule = schedule(:);
% Transmit the data using TDMA
txSignal = txSignal(:,schedule);
% Add channel noise to the transmitted signal
rxSignal = awgn(txSignal, 10);
% Perform IDCT on the received signal
rxSignal = idct(rxSignal);
% Demodulate the received signal using OFDM
rxModData = ofdmDemod(rxSignal);
0 Comments
Answers (1)
Abhinav Aravindan
on 3 Dec 2024 at 7:10
Edited: Abhinav Aravindan
on 3 Dec 2024 at 7:53
The “comm.RectangularQAMModulator” appears to accept only scalar or column vectors as input signals according to the documentation below.
However, the input data is in the form of a matrix in the above program resulting in the error. To resolve this, you may try providing the data as individual column vector inputs and then combining the results as per your requirement.
However, I would recommend you to use the “qammod” function as “comm.RectangularQAMModulator” has been removed from MATLAB R2024b and has been replaced with “qammod” which supports the Input signal as a scalar, vector, matrix or array.
You may refer to the documentation below for more information:
0 Comments
See Also
Categories
Find more on Modulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!