📄 mprbs.m
字号:
function [PNCode]= mPRBS(CellId,FrameNr,NFFTUsed)
% FPUL Frame Start of IEEE 802.16-2005 (WiMAX, OFDMA only)
% Input:
% NFFTUsed -- Number of FFT carrier
% Output:
% TileLUT -- Tile LUT
% Remark:
%
% Matlab 7 Release 14 SP2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mPRBS.m.rca $
% $Revision: 1.5 $
% $Date: Fri Nov 17 14:20:31 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-- Matlab files used by this file
%-- End of list
NumBits = NFFTUsed + 1 + 32;
%Calculate init state
if (bitand(CellId,16) > 0 ) %hex2dec('10')=16
PrbsState = 1;
else
PrbsState = 0;
end
if (bitand(CellId,8) > 0)
PrbsState = bitor(PrbsState,2);
end
if (bitand(CellId,4) > 0)
PrbsState = bitor(PrbsState,4);
end
if (bitand(CellId,2) > 0)
PrbsState = bitor(PrbsState,8);
end
if (bitand(CellId,1) > 0)
PrbsState = bitor(PrbsState,16); %hex2dec('10')=16
end
PrbsState = bitor(PrbsState,bitshift(3,5));
if (bitand(FrameNr,8) > 0)
PrbsState = bitor(PrbsState,128); % hex2dec('80')=128
end
if (bitand(FrameNr,4) > 0)
PrbsState = bitor(PrbsState,256); %hex2dec('100')=256
end
if (bitand(FrameNr,2) > 0)
PrbsState = bitor(PrbsState,512); %hex2dec('200')=512
end
if (bitand(FrameNr,1) > 0)
PrbsState = bitor(PrbsState,1024); %hex2dec('400')=1024
end
% generate PN sequence
PRBS_POLY = 5;
for PNIndex=1:NumBits
X = bitand(PrbsState,PRBS_POLY);
PrbsState = bitshift(uint16(PrbsState),-1);
switch X
case 0
PN(PNIndex) = 1;
case 1
PN(PNIndex) = -1;
PrbsState = bitor(PrbsState,1024); %hex2dec('400')=1024
case 4
PN(PNIndex) = 1;
PrbsState = bitor(PrbsState,1024); %hex2dec('400')=1024
case 5
PN(PNIndex) = -1;
otherwise
PN(PNIndex) = 1;
end
end
PNCode = PN;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -