?? 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 + -