필터 지우기
필터 지우기

Why do I receive "Error using RectangularQAMModulator"

조회 수: 7 (최근 30일)
Hanojhan Rajahrajasingh
Hanojhan Rajahrajasingh 2022년 12월 28일
% 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');
Warning: COMM.RECTANGULARQAMMODULATOR will be removed in a future release. Use QAMMOD instead. See this release note for more information.
% Create a QAM demodulator object
qamDemod = comm.RectangularQAMDemodulator('ModulationOrder', M, 'NormalizationMethod', 'Average power');
Warning: COMM.RECTANGULARQAMDEMODULATOR will be removed in a future release. Use QAMDEMOD instead. See this release note for more information.
% Generate a random data sequence for each node
data = randi([0 M-1], frameLength, numNodes);
% Modulate the data using QAM
modData = qamMod(data);
Error using RectangularQAMModulator
The input must be a column vector.
% 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개)

카테고리

Help CenterFile Exchange에서 QAM에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by