%% Apply PUSCH Precoding Codebook
% Modulate a random sequence of binary values of length 600 by using 64-QAM modulation. Split the modulated symbols into two layers.

modulation = '64QAM';
nlayers = 2;
in = randi([0 1],600,1);
data = nrSymbolModulate(in,modulation);
y = nrLayerMap(data,nlayers);

% Generate the PUSCH precoding matrix for four antennas, two layers, and the specified TPMI.

nports = 4;
tpmi = 7;
w = nrPUSCHCodebook(nlayers,nports,tpmi)

% Precode the layered modulation symbols by using the codebook matrix.

z = y * w

% Copyright 2018 The MathWorks, Inc.