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

2 次查看(过去 30 天)
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);

回答(1 个)

Muskan
Muskan 2023-5-16
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

类别

Help CenterFile Exchange 中查找有关 Modulation 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!