📄 preliminary_channel_coding.asv
字号:
function tx_block260 = Preliminary_channel_coding(tx244)
tx244 = round(rand(1,244));
%有用bit的抽取
g_function = [39 40 41 42 43 44 48 87 45 2,...
3 8 10 18 19 24 46 47 142 143,...
144 145 146 147 92 93 195 196 98 137,...
148 94 197 149 150 95 198 4 5 11,...
12 16 9 6 7 13 17 20 96 199,...
1 14 15 21 25 26 28 151 201 190,...
240 88 138 191 241];
l_gf = length(g_function);
for i = 1:l_gf
tx_impt(i) = tx244(g_function(i));
end
%CRC
g = [1 0 0 0 1 1 1 0 1];
out = addcrc(tx_imp,g);
p = out(66,73);
%
w(1:71) = tx244(1:71);
w(74:123) = tx244(74-2:123-2);
w(126:178) = tx244(126-4:178-4);
w(181:230) = tx244(181-6:230-6);
w(233:252) = tx244(233-8:252-8)
w(72) = w(73) = tx244(70);
w(124) = w(125) = tx244(120);
w(179) = w(180) = tx244(173);
w(232) = w(73) = tx244(70);
function output=addcrc(infor,g)
% infor is the input data.
% g is the coefficient array of ploy genarator
% output is the infor added crc codes
% infor = [ 0 0 1 0 1 1 0 0 0 1 1 0 ...
% 0 1 1 0 0 0 1 0 0 0 1 1 1 ]; % for 20070817_13
% infor = [ 1 0 1 0 1 1 0 0 0 1 0 1 ...
% 1 0 1 0 1 0 0 0 0 0 1 0 0 ]; % for 22
% infor = [ 1 0 1 0 1 1 0 0 1 0 0 1 0 ...
% 0 1 1 1 0 1 0 1 0 1 0 0 ]; %for \20070824_35.
% % infor = [ 1 0 1 1 0 0 1 0 1];
%
% infor = [ 1 0 1 0 1 1 0 0 1 0 1 1 1 ...
% 0 1 1 0 1 0 0 0 0 1 1 0 ]; %for \20070824_31.
%
% g = [1 0 1 0 1 1 1 0 1 0 1];
% g = [1 0 0 1];
a=length(infor);
b=length(g);
x=[infor zeros(1,b-1)]; % add g '0s'to the infor
len=length(x);
for i=1:a
if x(i)~=0
x(i:(i+b-1))=xor(x(i:(i+b-1)),g);
end
end
% output=[infor x((len):(-1):(len-b+2))];
output=[infor x((len-b+2):(len))];
% CRC = [x((len-b+2):(len))]
% crcr = [ 0 1 0 1 1 1 0 1 1 0 ]; % for 20070817_13
% crcr = [ 1 1 0 0 1 0 0 1 1 0 ]; %for \20070824_35.
% crcr = [ 1 0 1 0 1 0 0 0 1 0 ]; %for \20070824_31.
%
% % crcr = [ 0 1 1 1 0 0 1 0 1 1 ]; % for 22
% % crcr = [ 1 1 0 1 0 0 1 1 1 0 ]; % for 22
% xor( CRC,crcr)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -