MATLAB: 5G DMRS sequence generation

5G5g toolboxcommunication

The sequence generation is described in the spec (TS 38.211 5.2.1) and is implemented in the MATLAB 5G Toolbox function nrPRBS. Starting on line 61, there is a block of code:
% If a subsequence was requested, extract the subsequence
if ~isscalar(n)
prbs = prbsInternal(end-n(2)+1:end);
else
prbs = prbsInternal;
end
I have two related questions, What is the reason for requesting a subsequence? How does the UE know where to look for this DMRS sequence?

Best Answer

Hi Bryan,
The function nrPRBS accepts a vector or a scalar to specify the number of elements in the sequence, n.
When n is specified as a two element vector [p m], seq contains m contiguous elements of the PRBS generator, starting at position p (zero-based).
This pseudo-random sequence is used in generating the reference signals which are confined to the bandwidth part (BWP). The bandwidth part can start from any position in the carrier, which might be at an offset to point A. This is scenario where a subsequence can be used directly.
Consider the case of demodulation reference signal (DM-RS) of PDSCH, which is only a part of complete BWP. Now to generate the DM-RS sequence confined to only the resource blocks of PDSCH, the subsequence is used. The complete sequence starts from point A, but the required set is only for the resource blocks of PDSCH. Only the sequence of required set is transmitted.
The UE knows where to transmit/receive based on the allocation of the respective channel.
The comment placed in the code is related only to the function. As can be seen prbsInternal generates complete sequence, but only returns the set required that is requested with the function when n is used as vector.
Hope this helps.
Regards,
Sriram