scrambsync.m

来自「有关OFDM信道估计的matlab程序(其中包含英文简介和部分simulink模」· M 代码 · 共 36 行

M
36
字号
%generating idle sequence of all 1's
x=ones(2048,1);
%Initial lize the scrabling key
s=[1 0 0 0 0 0 0 0 0 0 0 0];
%geberating scrabled idle stream
for i=1:2048
s(2:12)=s(1:11);
s(1)=xor(s(12), s(10));
y(i)=xor(x(i), s(1));
end
%initialize scrambled sequence
c=y(1:11);
i=11;
sync=0;
%reset hypothesis
h=[0 0 0 0 0 0 0 0 0 0 0];
while sync==0
    i=i+1
    %update scrambled sequence
    c(2:12)=c(1:11);
    c(1)=y(i);
    %update hypothesis
    h(2:11)=h(1:10);
    h(1)=xor(c(1), xor(c(10), c(12)));
    %pattern match
    if h==[1 1 1 1 1 1 1 1 1 1 1]
        d=xor(c(1:11), h)
        sync=1;
    end
end
%descramble the idle stream
for j=i:2048
    d(2:12)=d(1:11);
    d(1)=xor(d(12), d(10));
    xx(j)=xor(y(j), d(1));
end

⌨️ 快捷键说明

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