?? coding.m
字號:
clear all;
clc;
%%%%%%%%%%%%define dimension of the parity check matrix%%%%%%%%
rows=100;
cols=200;
h=gen_ldpc(rows,cols);%generates a 100 x 200 H matrix( the IG parity
%check matrix)
[newh,rearranged_cols]=rearrange_cols(h);
% newh holds the rearranged version of H and rearranged_cols holds
%the rearrangement order of columns
%%%%%%%%%%%%Get A and B matrices %%%%%%%%%%%%%%%%
for i=1:rows
for j=1:rows
A(i,j)=newh(i,j);
end
end
for i=1:rows
for j=rows+1:cols
B(i,j-rows)=newh(i,j);
end
end
%%%%%%%%%%%%%%message bits%%%%%%%%%%%%%%%%%%%%%
%generate message bits randomly
for i=1:cols-rows
s(i)=round(rand);
end
s=s';% make it a row vector
%%%%%%% or load s from file %%%%type "help load" at matlab prompt for details
%%%%%%%%%%%%%%get check bits( Eqn.5)%%%%%%%%%%%%%%%%
d=mul_GF2(inv_GF2(A),B);
c=mul_GF2(d,s);
%%%%%%%%%%%%%%%%%form u'%%%%%%%%%%%%%
u1=c;
for i=rows+1:cols
u1(i)=s(i-rows);
end
%%%%%%%%%%%%%%% reorder u?to get the CW u %%%%%%%%%%%%%%%%%%%
u=reorder_bits(u1,rearranged_cols);
u
%%%%%%%%%%%%%%% u is the codeword to be transmitted %%%%%%%%%%%%%%%%%%%
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -