📄 turbo-encode.txt
字号:
% x ------信息源0 1 行向量
% g ------生成矩阵 g= 1 1 1
% 1 0 1 等
% [n,k]=size(g)
% m=k-1
% Alpha ---交织器 (交织器大小为 length(x)+m)
% puncture----是否凿孔 0--凿孔,码率1/2
% 1--不凿孔,码率1/3
% 程序最终输出en_output 为1 0行向量
function x_code_msg = turbo_encode( x_msg,g,Alpha,puncture)
[n,k] = size(g);
m = k - 1;
L_info = length(x_msg);
L_total = L_info + m;
input = x_msg;
output1 = rsc_encode(g,input,1);
y(1,:) = output1(1:2:2*L_total);
y(2,:) = output1(2:2:2*L_total);
for i = 1:L_total
input1(1,i) = y(1,Alpha(i));
end
output2 = rsc_encode(g, input1(1,1:L_total), -1 );
y(3,:) = output2(2:2:2*L_total);
if puncture > 0
for i = 1:L_total
for j = 1:3
en_output(1,3*(i-1)+j) = y(j,i);
end
end
else
for i=1:L_total
en_output(1,n*(i-1)+1) = y(1,i);
if rem(i,2)
en_output(1,n*i) = y(2,i);
else
en_output(1,n*i) = y(3,i);
end
end
end
x_code_msg=en_output;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -