nrPDSCHPrecode
Description
Examples
Precode PDSCH Symbols
Configure a carrier object and specify the number of transmit antennas.
carrier = nrCarrierConfig; carrier.NSizeGrid = 18; carrier.NStartGrid = 1; ntxants = 4;
Create the carrier grid.
txgrid = nrResourceGrid(carrier,ntxants);
Configure the PDSCH parameters.
pdsch = nrPDSCHConfig;
pdsch.Modulation = 'QPSK';
pdsch.NumLayers = 2;
pdsch.DMRS.NumCDMGroupsWithoutData = 1;
Create PDSCH indices for a PDSCH allocated in resource blocks 2 to 16 and 7 OFDM symbols starting at symbol 1. These indices are zero-based.
pdsch.PRBSet = 2:16; pdsch.SymbolAllocation = [1 7]; [portInd,indinfo] = nrPDSCHIndices(carrier,pdsch);
Create a PDSCH codeword and perform PDSCH modulation.
cw = randi([0 1],indinfo.G(1),1); portSym = nrPDSCH(carrier,pdsch,cw);
Create precoding matrices.
prgSize = 4; prgInfo = nrPRGInfo(carrier,prgSize); NPRG = prgInfo.NPRG; W = eye(pdsch.NumLayers,ntxants); W = reshape(kron(2:(NPRG+1),W),pdsch.NumLayers,ntxants,[]);
Perform PRG precoding.
[antSym,antInd] = nrPDSCHPrecode(carrier,portSym,portInd,W);
Map the precoded PDSCH to the carrier grid.
txgrid(antInd) = antSym;
Plot the carrier grid to show the PRGs. The PRGs align with common resoure block (CRB) 0, so only the last physical resource block (PRB) of the first PRG overlaps with the PDSCH allocation. The first CRB (0) is outside the carrier grid because carrier.NStartGrid
=1, and the next two CRBs (1 and 2) are outside the PDSCH allocation because pdsch.PRBSet
starts as 2.
The last PRG in the allocation can be partial, depending on the allocation size and alignment.
figure; imagesc(abs(txgrid(:,:,1))); axis xy; title('PDSCH PRG Bundling'); xlabel('OFDM Symbols'); ylabel('Subcarriers'); hold on; for i = 1:NPRG patch(NaN,NaN,i+1); end legend("PRG " + (1:NPRG));
Precode PDSCH Channel Estimate
Create carrier and PDSCH configuration objects with default parameters.
carrier = nrCarrierConfig; pdsch = nrPDSCHConfig;
Get OFDM information for the carrier configuration.
ofdmInfo = nrOFDMInfo(carrier);
Create an nrTDLChannel
System object™.
tdl = nrTDLChannel; P = 3; tdl.NumTransmitAntennas = 3; tdl.ChannelFiltering = false; tdl.SampleRate = ofdmInfo.SampleRate; tdl.NumTimeSamples = tdl.SampleRate * 1e-3;
Specify a PRG bundle size of 2. Get the PRG information for the bundle size and carrier configuration.
prgSize = 2; prgInfo = nrPRGInfo(carrier,prgSize);
Get PDSCH indices for the carrier and PDSCH configurations.
portInd = nrPDSCHIndices(carrier,pdsch);
Create a random precoding matrix.
nLayers = pdsch.NumLayers; nPRG = prgInfo.NPRG; W = complex(randn([nLayers P nPRG]),randn([nLayers P nPRG]));
Get the path gains and path filter impulse responses for the channel.
pathGains = tdl(); pathFilters = getPathFilters(tdl);
Perform channel estimation, extract PDSCH resources, and apply precoding. In this case, the output represents the effective channel between receive antennas and transmit layers.
H = nrPerfectChannelEstimate(carrier,pathGains,pathFilters); [symH,indH] = nrExtractResources(portInd,H); pdschH = nrPDSCHPrecode(carrier,symH,indH,permute(W,[2 1 3]));
Input Arguments
carrier
— Carrier configuration parameters
nrCarrierConfig
object
Carrier configuration parameters, specified as an nrCarrierConfig
object.
Only these object properties are relevant for this function.
portSym
— PDSCH symbols
complex matrix | complex 3-D array
PDSCH symbols, specified as one of these values:
Complex matrix of size NRE-by-NLAYERS, where NRE is the number of resource elements and NLAYERS is the number of layers.
Complex 3-D array of size NRE-by-R-by-P, where R is the number of receive antennas and P is the number of transmit antennas. This array represents the symbols of a PDSCH channel estimate.
This input and the portInd
input must have equal
sizes.
Data Types: double
| single
Complex Number Support: Yes
portInd
— PDSCH indices
matrix of positive integers | 3-D array of positive integers
PDSCH indices, specified as one of these values:
Matrix of positive integers of size NRE-by-NLAYERS.
3-D array of positive integers of size NRE-by-R-by-P. This array represents the indices of a PDSCH channel estimate.
Data Types: double
W
— Precoding matrices
complex 3-D array
Precoding matrices, specified as one of these values:
Complex 3-D array of size NLAYERS-by-P-by-NPRG, where NPRG is the number of precoding resource block groups (PRGs) in the carrier resource grid. Use this size when you specify
portSym
andportInd
as matrices.Complex 3-D array of size P-by-NLAYERS-by-NPRG, where NPRG. Use this size when you specify
portSym
andportInd
as 3-D arrays.
This input contains one precoding matrix for each PRG.
Data Types: double
| single
Complex Number Support: Yes
Output Arguments
antSym
— Precoded PDSCH symbols
complex matrix | complex 3-D array
Precoded PDSCH symbols, returned as one of these values:
Complex matrix of size NRE-by-P.
Complex 3-D array of size NRE-by-R-by-NLAYERS. This array represents the effective channel between receive antennas and transmit layers. You can use this option to precode a PDSCH allocation that you extracted from the channel estimate returned by the
nrPerfectChannelEstimate
function.
The function returns a matrix when you specify portSym
and
portInd
as matrices, and a 3-D array when you specify them
as 3-D arrays.
Data Types: double
| single
Complex Number Support: Yes
antInd
— Precoded PDSCH antenna indices
matrix of positive integers | 3-D array of positive integers
References
[1] 3GPP TS 38.214. “NR; Physical layer procedures for data.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[2] 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2023b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)