%% Generate PBCH Scrambling Sequence
% Generate the first 864 outputs of the PBCH scrambling sequence initialized with the specified physical layer cell identity number. The specified length of 864 corresponds to the PBCH bit capacity as specified in TS 38.212 Section 7.1.5. Consider the 43rd Synchronization Signal / Physical Broadcast Channel (SS/PBCH) block in a burst. Assume that the number of SS/PBCH blocks per half-frame is 64.

ncellid = 17;
ssbindex = 42;
v = mod(ssbindex,8); % assume L_max = 64
E = 864; 
seq = nrPBCHPRBS(ncellid,v,E);

% Copyright 2019 The MathWorks, Inc.