当前位置:网站首页>【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
边栏推荐
- The role of /etc/resolv.conf
- 无状态与有状态的区别
- SQL注入 Less38(堆叠注入)
- 基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真
- 对象缓存服务的思考和实现
- How to import a Golang external package and use it?
- 基于mysql的消息队列设计
- 「SDOI2016」征途 题解
- To help the construction of digital government, the three parties of China Science and Technology build a domain name security system
- Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
猜你喜欢
I don't know what to do with sync issues

MLP神经网络,GRNN神经网络,SVM神经网络以及深度学习神经网络对比识别人体健康非健康数据

基于mysql的消息队列设计

Design of Fire and Anti-theft System Based on Single Chip GSM

C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处

【1161. 最大层内元素和】

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

面试突击69:TCP 可靠吗?为什么?

基于simulink的Passive anti-islanding-UVP/OVP and UFP/OFP被动反孤岛模型仿真

The article you worked so hard to write may not be your original
随机推荐
Advanced Algebra _ Proof _ Any matrix is similar to an upper triangular matrix
Unity - by casting and cloning method dynamic control under various UGUI create and display
Flutter教程之 01配置环境并运行demo程序 (教程含源码)
「APIO2010」巡逻 题解
字符编码和浮点型计算精度丢失问题
Pytest first experience
/etc/resolv.conf的作用
什么是动态规划,什么是背包问题
什么是客户画像管理?
NgRx 里 first 和 take(1) 操作符的区别
Design of Fire and Anti-theft System Based on Single Chip GSM
「SDOI2016」征途 题解
数据分析(一)——matplotlib
Drawing process of hand-drawn map of scenic spots
面试突击69:TCP 可靠吗?为什么?
周总结
SQL27 View user details of different age groups
#yyds干货盘点# 面试必刷TOP101:链表中环的入口结点
Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示
Audio alignment using cross-correlation