Why do I receive "Error using RectangularQAMModulator"
조회 수: 7 (최근 30일)
이전 댓글 표시
% 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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 QAM에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!