📄 turbo_sys_demo.m
字号:
clc;clear all;% Write display messages to a text filediary 帧长4096信噪比-10迭代20次.txt% Choose decoding algorithm dec_alg = 0;% Frame sizeL_total = 4096; % infomation bits plus tail bits% Code generatorg = [ 1 1 1; 1 0 1 ];[n,K] = size(g); m = K - 1;nstates = 2^m; puncture = 0;% Code raterate = 1/(2+puncture); % Fading amplitude; a=1 in AWGN channela = 1; % Number of iterations niter = 20; EbN0db = [-10]; nEN = 1; en = 10^(EbN0db(nEN)/10); % convert Eb/N0 from unit db to normal numbers L_c = 4*a*en*rate; % reliability value of the channel sigma = 1/sqrt(2*rate*en); % standard deviation of AWGN noise x = round(rand(1, L_total-m)); % info. bits [temp, alpha] = sort(rand(1,L_total)); % random interleaver mapping en_output = encoderm( x, g, alpha, puncture ) ; % encoder output (+1/-1) r = en_output+sigma*randn(1,L_total*(2+puncture)); % received bits yk = demultiplex(r,alpha,puncture); % demultiplex to get input for decoder 1 and 2 % Scale the received bits rec_s = 0.5*L_c*yk;% Initialize extrinsic information L_e1= zeros(niter,L_total); L_e2= zeros(niter,L_total); L_e=zeros(1,L_total); for iter = 1:niter% Decoder one L_a(alpha) = L_e; % a priori info. if dec_alg == 0 L_all = logmapo(rec_s(1,:), g, L_a, 1); % complete info. else L_all = sova0(rec_s(1,:), g, L_a, 1); % complete info. end L_e = L_all - 2*rec_s(1,1:2:2*L_total) - L_a; % extrinsic info. L_e1(iter,:)=L_e(1,:);% Decoder two L_a = L_e(alpha); % a priori info. if dec_alg == 0 L_all = logmapo(rec_s(2,:), g, L_a, 2); % complete info. else L_all = sova0(rec_s(2,:), g, L_a, 2); % complete info. end L_e = L_all - 2*rec_s(2,1:2:2*L_total) - L_a; % extrinsic info. L_e2(iter,:)=L_e(1,:); end save turbo_sys_demo L_e1 L_e2 L_e1 L_e2 diary off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -