参考文献
[1] [2] [3] [4] [5] [6] 版社,2006
[7] [8]
张德丰. MATLAB/Simulink建模与仿真. 电子工业出版社,2009 邵玉斌. MATLAB/SIMULINK通信系统建模与仿真实例分析. 清华大学贺鹤云. LDPC码基础与应用. 人民邮电出版社,2009 袁东风, 张海刚. LDPC码理论与应用, 人民邮电出版社,2008 符初生,周亮,文红. LDPC码原理与应用. 电子科技大学出版社,2006 (美)传特. 通信系统仿真原理与无线应用. 机械工业出版社,2005 周建兴. MATLAB从入门到精通. 人民邮电出版社, 2008
(美)亨塞尔曼,(美)利特菲尔德. 精通Matlab 7. 清华大学出
出版社,2008
[9]
张建国.LDPC码的应用研究[J].通信技术.2003年11期2
[10] 李水平,刘玉君,王云鹤.串行级联LDPC码[J].信息工程大学学报.2004年02期
[11] 苏杰,王琳,赵春雨.规则LDPC码在瑞利平坦衰落信道下的设计和仿真[J].电讯技术.2004年05期
[12] 王鹏,王新梅.LDPC码的快速编码研究[J].西安电子科技大学学报.2004年06期
[13] 仲海梅,王锐华.4G中的纠错编码技术LDPC码及其新进展[J].广东通信技术.2004年12期
[14] J Chen, A Dholakia, E Eleftheriou. “Reduced-complexity decoding of LDPC codes”. 2005.
21
代码
% Bit error rate of BPSK modulated LDPC codes under AWGN channel clc; clear all;
% LDPC matrix size, rate must be 1/2
% Warning: encoding - decoding can be very long for large LDPC matrix! M = 1000; N = 2000;
% Method for creating LDPC matrix (0 = Evencol; 1 = Evenboth) method = 1;
% Eliminate length-4 cycle noCycle = 1;
% Number of 1s per column for LDPC matrix onePerCol = 3;
% LDPC matrix reorder strategy (0 = First; 1 = Mincol; 2 = Minprod) strategy = 2;
% EbN0 in dB
EbN0 = [0 0.5 1 1.5];
% Number of iteration; iter = 5;
% Number of frame (N bits per frame) frame = 10;
% Make the LDPC matrix
H = makeLdpc(M, N, 1, 1, onePerCol);
for i = 1:length(EbN0)
ber1(i) = 0; ber2(i) = 0;
% Make random data (0/1)
dSource = round(rand(M, frame));
for j = 1:frame
fprintf('Frame : %d\\n', j);
% Encoding message
[c, newH] = makeParityChk(dSource(:, j), H, strategy); u = [c; dSource(:, j)];
% BPSK modulation bpskMod = 2*u - 1;
% Additional white gaussian noise N0 = 1/(exp(EbN0(i)*log(10)/10));
tx = bpskMod + sqrt(N0/2)*randn(size(bpskMod));
22
% Decoding (select decoding method)
%vhat = decodeProbDomain(tx, H, newN0, iter); vhat1 = decodeLogDomain(tx, newH, N0, iter); vhat2 = decodeLogDomainSimple(tx, newH, iter); %vhat = decodeBitFlip(tx, newH, ter);
% Get bit error rate (for brevity, BER calculation includes parity bits) [num1, rat1] = biterr(vhat1', u); ber1(i) = (ber1(i) + rat1);
[num2, rat2] = biterr(vhat2', u); ber2(i) = (ber2(i) + rat2);
end % for j
% Get average of BER ber1(i) = ber1(i)/frame; ber2(i) = ber2(i)/frame;
end % for i
% Plot the result
semilogy(EbN0, ber1, 'o-'); hold;
semilogy(EbN0, ber2, 'o--'); grid on; hold off;
function H = makeLdpc(M, N, method, noCycle, onePerCol) % Create R = 1/2 low density parity check matrix %
% M : Number of row % N : Number of column
% method : Method for distributing non-zero element
% {0} Evencol : For each column, place 1s uniformly at random
% {1} Evenboth: For each column and row, place 1s uniformly at random % noCyle : Length-4 cycle
% {0} Ignore (do nothing) % {1} Eliminate
% onePerCol: Number of ones per column %
% H : Low density parity check matrix % %
% Copyright Bagawan S. Nugroho, 2007 % http://bsnugroho.googlepages.com
% Number of ones per row (N/M ratio must be 2) if N/M ~= 2
fprintf('Code rate must be 1/2\\n'); end
onePerRow = (N/M)*onePerCol;
fprintf('Creating LDPC matrix...\\n');
23
switch method % Evencol case {0}
% Distribute 1s uniformly at random within column for i = 1:N
onesInCol(:, i) = randperm(M)'; end
% Create non zero elements (1s) index
r = reshape(onesInCol(1:onePerCol, :), N*onePerCol, 1); tmp = repmat([1:N], onePerCol, 1); c = reshape(tmp, N*onePerCol, 1);
% Create sparse matrix H H = full(sparse(r, c, 1, M, N));
% Evenboth case {1}
% Distribute 1s uniformly at random within column for i = 1:N
onesInCol(:, i) = randperm(M)'; end
% Create non zero elements (1s) index
r = reshape(onesInCol(1:onePerCol, :), N*onePerCol, 1); tmp = repmat([1:N], onePerCol, 1); c = reshape(tmp, N*onePerCol, 1);
% Make the number of 1s between rows as uniform as possible
% Order row index [r, ix] = sort(r);
% Order column index based on row index for i = 1:N*onePerCol cSort(i, :) = c(ix(i)); end
% Create new row index with uniform weight tmp = repmat([1:M], onePerRow, 1); r = reshape(tmp, N*onePerCol, 1);
% Create sparse matrix H
% Remove any duplicate non zero elements index using logical AND S = and(sparse(r, cSort, 1, M, N), ones(M, N)); H = full(S);
end % switch
% Check rows that have no 1 or only have one 1 for i = 1:M
n = randperm(N);
% Add two 1s if row has no 1 if length(find(r == i)) == 0 H(i, n(1)) = 1;
24
相关推荐: