%% Generate and Decode PUSCH Modulation Symbols
% Specify a random sequence of binary values corresponding to a codeword of 8064 bits.

cw = randi([0 1],8064,1);

% Using 256-QAM modulation, generate PUSCH modulation symbols for the specified physical layer cell identity number, RNTI, and two transmission layers. By default, this function disables transform precoding and noncodebook-based transmission.

modulation = '256QAM';
nlayers = 2;
ncellid = 17;
rnti = 111;
sym = nrPUSCH(cw,modulation,nlayers,ncellid,rnti)

% Decode the PUSCH modulation symbols.

demod = nrPUSCHDecode(sym,modulation,ncellid,rnti)

% Perform hard decision on the soft metric.

rxcw = double(demod<0)

% Compare the result with the original codeword.

isequal(cw,rxcw)

% Copyright 2018 The MathWorks, Inc.