📄 r_mod_cod_intlv.m
字号:
% Deinterleaving,decoding and demod received signal
% By Yuanye Wang
% CTIF,AAU
% yywang@kom.aau.dk
function [blk_err_c,blk_tot_c,bit_err_u,bit_tot_u,bit_err_c,bit_tot_c,bnum2_u,bnum2_c,tpb_u,tpb_c,fnum_u,fnum_c] = ...
R_mod_cod_intlv(N,subN,R_comb,fact1,B,rdstate,code_rate,real_len,t,coded,T_sent,intleav)
fnum_u = zeros(1,floor(N/subN)); fnum_c = zeros(1,floor(N/subN));
blk_err_c=zeros(1,floor(N/subN));% stores whether the particular block is in error or not
% if the block is in error, a '1' will be put in
% the place, if it is not in error '0' will used.
blk_tot_c=zeros(1,floor(N/subN));% whether the block is loaded or not
bit_err_u=zeros(1,floor(N/subN)); % stores the number of bits in error for uncoded
% configuration, for each block
bit_tot_u=zeros(1,floor(N/subN)); % total number of uncoded bits loaded in each block
bit_err_c=zeros(1,floor(N/subN)); % stores the number of bits in error for coded
% configuration, for each block
bit_tot_c=zeros(1,floor(N/subN)); % stores the total number of coded bits loaded in each block
for k = 1:floor(N/subN) % 1:512 % for each block
tp = R_comb((k-1)*subN+1:k*subN,:).';
tp2 = tp(:).';
if fact1(k)~=0
r_dmd = qdemodulator(tp2/fact1(k),2^B(k));
dintlv=randdeintrlv(r_dmd,rdstate);
%r_dcd = BR_decode2(code_rate(k),dintlv(1:real_len(k)),t(k));
r_dcd = BR_decode2(code_rate(k),dintlv(1:real_len(k)),t{k});
bnum2_u(k) = biterr(dintlv,coded{k}); % uncoded wrong bits
bnum2_c(k) = biterr(r_dcd,T_sent{k}); % coded wrong bits
blk_tot_c(k)=blk_tot_c(k)+1;% increase the count for the loaded blocks
bit_tot_u(k)=bit_tot_u(k)+length(dintlv);%
bit_tot_c(k)=bit_tot_c(k)+length(r_dcd);%
else
r_dmd = []; dintlv = [];
bnum2_u(k) = 0; bnum2_c(k) = 0;
end
tpb_u(k) = length(intleav{k}); % throughput for uncoded, if no error
tpb_c(k) = length(T_sent{k}); % throughput for coded, if error
if bnum2_u(k)>0 % with error
fnum_u(k) = fnum_u(k) +1; % fer + 1
tpb_u(k) = 0; % throughput set to 0
end
if bnum2_c(k)>0 % with error
fnum_c(k) = fnum_c(k) +1; % fer + 1
tpb_c(k) = 0; % throughput set to 0
end
end
% store data for each block
blk_err_c=fnum_c; % whether the block is in error or not
bit_err_u=bnum2_u;% total number of bits in error in each block for uncoded system
bit_err_c=bnum2_c;% total number of bits in error in each block for coded system
%% yy's new part
bnum2_u = sum(bnum2_u);
bnum2_c = sum(bnum2_c);
tpb_u = sum(tpb_u);
tpb_c = sum(tpb_c);
fnum_u = sum(fnum_u);
fnum_c = sum(fnum_c);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -