当前位置:网站首页>【MATLAB项目实战】LDPC-BP信道编码
【MATLAB项目实战】LDPC-BP信道编码
2022-07-31 23:24:00 【大桃子技术】
除了Turbo码之外, Gallger于 1960年提出的低密度校验(Low Density ParityCheck,LDPC)码也能逼近香农界。本节介绍二进制LDPC码的仿真实现







不同码元长度WER变化情况:
从图中可以看出,码长是影响LDPC码性能的一个重要因素,LDPC码译码性能随着码长的增长有显著的改善。码长为1024的编码比码长为512的编码在性能上约有0.5dB的提高
主程序:
clc;clear all;
SNRdB=0:0.25:3; %SNR in dB
k=512/4;
n=1024/4; % 码长
niter= 60;% 最大迭代此时
nb_err = zeros(1,length(SNRdB));
nb_code = zeros(1,length(SNRdB));
nb_err_max= 100 ;
nb_code_max= 1e4;
H= gen_h(n,6,3);% 产生H
[Hs,H]=gen_Hs(H); % 化为系统码
Q= Hs(:,1:k)'; % 生成矩阵的Q
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);% 其平方是噪声功率
while nb_err(s)<nb_err_max && nb_code(s)<nb_code_max
nb_code(s) = nb_code(s)+1;
b = rand(1,k)<0.5;
c=[b,rem(b*Q,2)];% 系统码编码
x=(-1).^c;% BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%软解调
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %c是发送码字,hat_c是硬判决
if err
nb_err(s)= nb_err(s)+err;
disp([nb_err;nb_code])
end
end
end
WER= nb_err./nb_code;
EbN0dB= SNRdB+10*log10(n/k/2);%化成Eb/N0,参考式(1)
figure(1)
semilogy(EbN0dB, WER,'o-','LineWidth',2)
xlabel('Eb/N0')
ylabel('WER')
grid on;
hold on
SNRdB=0:0.25:3; %SNR in dB
k=512/2;
n=1024/2; % 码长
niter= 60;% 最大迭代此时
nb_err = zeros(1,length(SNRdB));
nb_code = zeros(1,length(SNRdB));
nb_err_max= 100 ;
nb_code_max= 1e4;
H= gen_h(n,6,3);% 产生H
[Hs,H]=gen_Hs(H); % 化为系统码
Q= Hs(:,1:k)'; % 生成矩阵的Q
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);% 其平方是噪声功率
while nb_err(s)<nb_err_max && nb_code(s)<nb_code_max
nb_code(s) = nb_code(s)+1;
b = rand(1,k)<0.5;
c=[b,rem(b*Q,2)];% 系统码编码
x=(-1).^c;% BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%软解调
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %c是发送码字,hat_c是硬判决
if err
nb_err(s)= nb_err(s)+err;
disp([nb_err;nb_code])
end
end
end
WER= nb_err./nb_code;
EbN0dB= SNRdB+10*log10(n/k/2);%化成Eb/N0,参考式(1)
figure(1)
semilogy(EbN0dB, WER,'s-','LineWidth',2)
xlabel('Eb/N0')
ylabel('WER')
grid on;
hold on
SNRdB=0:0.25:3; %SNR in dB
k=512;
n=1024; % 码长
niter= 60;%最大迭代此时
nb_err = zeros(1,length(SNRdB));
nb_code = zeros(1,length(SNRdB));
nb_err_max= 100 ;
nb_code_max= 1e4;
H= gen_h(n,6,3);%产生H
[Hs,H]=gen_Hs(H); %化为系统码
Q= Hs(:,1:k)'; %生成矩阵的Q
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);%其平方是噪声功率
while nb_err(s)<nb_err_max && nb_code(s)<nb_code_max
nb_code(s) = nb_code(s)+1;
b = rand(1,k)<0.5;
c=[b,rem(b*Q,2)];%系统码编码
x=(-1).^c;%BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%软解调
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %c是发送码字,hat_c是硬判决
if err
nb_err(s)= nb_err(s)+err;
disp([nb_err;nb_code])
end
end
end
WER= nb_err./nb_code;
EbN0dB= SNRdB+10*log10(n/k/2);%化成Eb/N0,参考式(1)
figure(1)
semilogy(EbN0dB, WER,'^-','LineWidth',2)
xlabel('Eb/N0')
ylabel('WER')
grid on;
legend('n=256','n=512','n=1024')
代码链接(包括word文档):https://download.csdn.net/download/qq_45047246/86268695
边栏推荐
- SQL injection Less42 (POST type stack injection)
- SQL injection Less46 (injection after order by + rand() Boolean blind injection)
- Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
- 【Acwing】第62场周赛 题解
- 助力数字政府建设,中科三方构建域名安全保障体系
- How to reduce the gap between software design and implementation
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- [QNX Hypervisor 2.2用户手册]9.16 system
- 基于mysql的消息队列设计
- Summary of the classic drawing method of histogram
猜你喜欢

新产品如何进行网络推广?
Mysql environment installation under Linux (centos)

UOS - WindTerm use

高等代数_证明_任何矩阵都相似于一个上三角矩阵
![[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories](/img/7a/278ffada1cc660e7f5c2d7c66fa38e.png)
[Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories

基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真

消息队列存储消息数据的MySQL表格

网易云信圈组上线实时互动频道,「破冰」弱关系社交

一文概述:VPN的基本模型及业务类型

Audio alignment using cross-correlation
随机推荐
I don't know what to do with sync issues
2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法
lua入门案例实战123DIY
VOT2021 game introduction
/etc/sysconfig/network-scripts configure the network card
Drawing process of hand-drawn map of scenic spots
日常--Kali开启SSH(详细教程)
thymeleaf迭代map集合
MySQL数据库‘反斜杠\’ ,‘单引号‘’,‘双引号“’,‘null’无法存储
基于simulink的Active anti-islanding-AFD主动反孤岛模型仿真
嵌入式开发没有激情了,正常吗?
TypeScript 的组件
周总结
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
[QNX Hypervisor 2.2用户手册]9.16 system
UOS统信系统 - WindTerm使用
Collation of knowledge points in Ningbo University NBU IT project management final exam
Binary tree non-recursive traversal
面试突击69:TCP 可靠吗?为什么?
Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios