random.m

来自「matlabprograminofdmsoplztakecareurself」· M 代码 · 共 36 行

M
36
字号
function [out] = random(msg,BSID,DIUC,Frame);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                       %
%%     Name: random.m                                                    %
%%                                                                       %
%%     Description: This function is realisez uniquely by the way        %
%%      defined in the standard. It is one more stage in the encoding.   %
%%                                                                       %
%%                                                                       %
%%     Parameters:                                                       %
%%       msg  --> Sequence of bits to encode with the algorithm BSID,    %
%%       DIUC, Frame--> Identifiers of the connection that is carried    %
%%       out.(Base Station, Downlink and the number of frames)           %
%%                                                                       %
%%                                                                       %
%%     Result: It gives back the chain of bits encoded accordin to       %
%%      the need (following DIUC, BSID and Frame). The encoding and      %
%%      decoding are an identical process.                               %
%%                                                                       %
%%                                                                       %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

seed = zeros (1,15);
seed=[de2bi(BSID,4,'left-msb') 1 1 de2bi(DIUC,4,'left-msb') 1 de2bi(Frame,4,'left-msb')];

out=zeros(1,length(msg));

for i=1:length(msg)
    next = xor(seed(14),seed(15));
    out(i) = xor( msg(i),next);
    seed = [next seed(1,1:14)];
end

return;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?