⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.m

📁 关于低密度奇偶校验码的生成
💻 M
字号:
 function  main     
         sigma = 1;                          % AWGN noise deviation
         q = 4;                              % Field parameter
         nbits = log2(q);                    % bits per symbol
         rows=15;
         cols=20;
         h = gen_ldpc(rows,cols);                % Generate H
         [H,G] = ldpc_h2g(h,q);              % find systematic G and modify H
         x = floor(rand(1,size(G,1))*q);     % random symbols
         y = ldpc_encode(x,G,q);             % encoding 
         yb = (fliplr(de2bi(y,nbits)))';     % convert total index to binary format
         yb = yb(:);                         % make a vector
         zb = 2*yb-1;                        % BPSK modulation
         zb=zb + sigma*randn(size(zb));      % AWGN transmission

         f1=1./(1+exp(-2*zb/sigma^2));        % likelihoods for bits
         f1 = f1(:);                         % make it a vector
         f1 = reshape(f1,nbits,length(y));   % reshape for finding priors on symbols                    
         f0=1-f1;
         junk = ones(q,length(y));           % this is a placeholder in the next function
         [v0, v1, pp] = bits_smbl_msg(f0,f1,junk);
         [z_hat, success, k] = ldpc_decode(pp,H,q);
         x_hat = z_hat(size(G,2)+1-size(G,1):size(G,2));
         x_hat = x_hat'; 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -