%% Decode PDSCH Symbols using Object
% Create a carrier configuration object, specifying the slot number as 10 and physical layer cell identity as 42.

carrier = nrCarrierConfig;
carrier.NCellID = 42;

% Create a PDSCH configuration object wtih '16QAM' modulation scheme, radio network temporary identifier as 1005 and transmission layer 1.

pdsch = nrPDSCHConfig;
pdsch.Modulation = '16QAM';
pdsch.NumLayers = 1;
pdsch.RNTI = 1005;

% Generate PDSCH symbols for a single codeword of 8000 bits with the specified carrier configuration, carrier and downlink shared channel configuration, pdsch.

cws = randi([0 1],8000,1);
sym = nrPDSCH(carrier,pdsch,cws);

% Add an additive white Gaussian noise (AWGN) to the PDSCH symbols. Then demodulate to produce soft bit estimates.

 SNR = 30; % SNR in dB
 rxsym = awgn(sym,SNR);
 [rxbits,symbols] = nrPDSCHDecode(carrier,pdsch,rxsym);

% Copyright 2019 The MathWorks, Inc.