%% Compare PSSCH DM-RS Resource Element Indexing
% Compare PSSCH DM-RS resource element indexing formats.
% Create a UE settings structure.

ue = struct('NSLRB',15,'CyclicPrefixSL','Normal','PRBSet',5);

% Generate PSSCH DM-RS indices using one-based linear indexing (default), zero-based linear indexing, and one-based subscript row style.
%
%% One-based linear indexing

psschdmrs_indices = ltePSSCHDRSIndices(ue);
psschdmrs_indices(1)

%
%% Zero-based linear indexing

opts = '0based';
psschdmrs_indices_0based = ltePSSCHDRSIndices(ue,opts);
psschdmrs_indices_0based(1)

% For zero-based indexing, the first assigned index is one lower than the one-based indexing.
%
%% One-based indexing in [subcarrier,symbol,port] subscript row style
% Inspect the unique symbol values to see which symbols are occupied by the PSSCH DM-RS.

opts = {'sub' '1based'};
psschdmrs_indices_sub = ltePSSCHDRSIndices(ue,opts);
unique(psschdmrs_indices_sub(:,2,:))

% Only symbols 4 and 11 are occupied. For one-based indexing, these two PSSCH subframe symbols are always reserved for transmission of the PSSCH DM-RS.
% Copyright 2012 The MathWorks, Inc.