当前位置:网站首页>[MATLAB project combat] LDPC-BP channel coding
[MATLAB project combat] LDPC-BP channel coding
2022-07-31 23:32:00 【big peach technique】
除了Turbo码之外, Gallger于 1960Low-density checksums proposed in (Low Density ParityCheck,LDPC)The code can also approach the Shannon world.This section describes binaryLDPCcode simulation
different symbol lengthsWER变化情况:
从图中可以看出,Code length is an influenceLDPCan important factor in code performance,LDPCThe decoding performance of the code is significantly improved with the increase of the code length.码长为1024The code is longer than the code length512The encoding has a performance of approx0.5dB的提高
主程序:
clc;clear all;
SNRdB=0:0.25:3; %SNR in dB
k=512/4;
n=1024/4; % 码长
niter= 60;% Maximum iteration at this time
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); % into a system code
Q= Hs(:,1:k)'; % generate a matrixQ
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);% Its square is the noise power
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)];% System code encoding
x=(-1).^c;% BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%soft demodulation
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %cis the transmit codeword,hat_cis a hard judgment
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;% Maximum iteration at this time
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); % into a system code
Q= Hs(:,1:k)'; % generate a matrixQ
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);% Its square is the noise power
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)];% System code encoding
x=(-1).^c;% BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%soft demodulation
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %cis the transmit codeword,hat_cis a hard judgment
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;%Maximum iteration at this time
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); %into a system code
Q= Hs(:,1:k)'; %generate a matrixQ
for s= 1:length(SNRdB)
sigma = 10^(-SNRdB(s)/20);%Its square is the noise power
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)];%System code encoding
x=(-1).^c;%BPSK modulation
noise = sigma * randn(1,length(x));
y = x+noise;
lam_ch= 2*y/sigma^2;%soft demodulation
hat_c= msa(lam_ch,niter,H);
err = any(hat_c~=c); %cis the transmit codeword,hat_cis a hard judgment
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
边栏推荐
猜你喜欢
一文概述:VPN的基本模型及业务类型
如何减少软件设计和实现之间鸿沟
【云驻共创】【HCSD大咖直播】亲授大厂面试秘诀
Pytest初体验
UOS统信系统 - WindTerm使用
Program processes and threads (concurrency and parallelism of threads) and basic creation and use of threads
Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决
不知道该怎么办的同步问题
Daily--Kali opens SSH (detailed tutorial)
Interview assault 69: TCP reliable?Why is that?
随机推荐
Drawing process of hand-drawn map of scenic spots
The uniapp applet checks and prompts for updates
简单的vim配置
Handwritten a simple web server (B/S architecture)
编写方法将一个数组扁平化并且去重和递增排序
什么时候可以使用 PushGateway
二叉树非递归遍历
[QNX Hypervisor 2.2 User Manual]9.16 system
HTC using official firmware as bottom bag made ROM brush card bag tutorial
Shell common script: Nexus batch upload local warehouse script
Unity-LineRenderer显示一条线
C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
/etc/sysconfig/network-scripts 配置网卡
日常--Kali开启SSH(详细教程)
HTC使用官方固件作为底包制作rom卡刷包教程
Design of Fire and Anti-theft System Based on Single Chip GSM
什么是动态规划,什么是背包问题
数据分析(一)——matplotlib
周总结
网络安全--通过握手包破解WiFi(详细教程)