why ofdmmod function error: The total number of subcarriers, including data, nulls and pilots specified, must match NFFT when my carrier number is8192

2 views (last 30 days)
moduType = '16qam';
numCarr =8192;
M = 16;
numBits = numCarr * log2(M);
numGBCarr = numCarr/16;
gbleft = (1:numGBCarr);
gbright = ((numCarr-numGBCarr+1):numCarr);
%%%%%%%%%%%%create null
dcIdx = (numCarr/2)+1;%偶数个子载波得dc索引
nullIdx = [gbleft dcIdx gbright]';%子载波索引列
%%%%%%%%%%%%create sign
nullLen = length(nullIdx);
srcBits = randi([0,1],(numBits-nullLen)*log2(M),1);
%%%%%%%%%%%%qammod
sigOut = qammod(sign,M,"InputType","bit","UnitAveragePower",true);
%%%%%%%%%%%%cplength
CPlen = 32;
%%%%%%%%%%%%进行ofdm调制
ofdmOut = ofdmmod(sigOut,numCarr,CPlen,nullIdx);
error used ofdmmod>checkNulls (line 188)
The total number of subcarriers, including data, nulls and pilots specified, must match NFFT.
mistake ofdmmod>setup (line 147)
checkNulls(prmStr,numST);
mistake ofdmmod (line 66)
[prmStr,dataIdx] = setup(x,nfft,cplen,varargin{:});
mistake main (line 29)
ofdmOut = ofdmmod(sigOut,numCarr,CPlen,nullIdx);

Answers (1)

Muskan
Muskan on 16 May 2023
Hi,
I tried running your code, and as per my understanding of the question, it gives an error while using the "qammod" function. You can refer to the following documentation of "qammod" function for a correct implementation.
Thanks

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!