Layer demapping onto scrambled and modulated codewords
Map a single codeword of length 20 to four transmission layers.
codeword = ones(20,1); nLayers = 4; layeredOut = nrLayerMap(codeword,nLayers);
Recover the original codeword using layer demapping.
out = nrLayerDemap(layeredOut);
Check for errors.
ans = logical 1
in— Layered modulation symbols
Layered modulation symbols, specified as a complex matrix of size M-by-nLayers. M is the number of modulation symbols in a transmission layer. nLayers is the number of transmission layers in the range 1 to 8.
Complex Number Support: Yes
out— Modulation symbols in codewords
Modulation symbols in codewords, returned as a cell array of one or two complex
column vectors. This output inherits the data type of the input
One vector corresponds to one codeword. The number of codewords is based on the number
of layers. The function determines the number of codewords using TS 38.211 Table
 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.