资源简介
简单实用的LDPC BP算法;适用于新手理解算法过程。
代码片段和文件信息
function [ outputdecode ] = SPA_decode( H r_num c_num EbN0 Rs )
%SPA_decode this function is used to decode LDPC codes with SPA method.
% input: H --------the check matrix
% c_num-----how many columns in H
% r_num-----how many rows in H
% EbNo------EbN0 for the AWGN channel which is used to calculate log(p1/p0)
% Rs--------receive signals
% output: outputdecode-----the decode result which is only 0s and 1s
Receive = 2 * Rs * 2 * EbN0; %% 假定信号功率为1;
%%%%%%%%%%%%%%% set parameter %%%%%%%%%%%%%%%%%%%%%
it_num = 20; %iteration number
row_nonzero_index = zeros(r_numc_num); %H中每行里1的位置
col_nonzero_index = zeros(r_numc_num); %H中每列里1的位置
row_nonzero_number = zeros(r_num1); %H中每行1的个数
col_nonzero_number = zeros(c_num1); %H中每列1的个数
u_ml = zeros(r_numc_num); %校验节点(对校验节点的更新值)
v_ml = zeros(r_numc_num); %变量节点(对变量节点的更新值)
v_l = zeros(1c_num); %似后验概率
v_l0 = zeros(1c_num); %初始后验概率信息
%%%%%%%%%%%%%%% initialization %%%%%%%%%%%%%%%%%%%%
% 找到每行中1的位置
for i = 1:r_num
row_nonzero_number(i) = length(find(H(i:)));
row_nonzero_index(i:) = [find(H(i:)) zeros(1c_num-row_nonzero_number(i))];
end
% 找到每列中1的位置
for j = 1:c_num
col_nonzero_number(j) = length(find(H(:j)));
col_nonzero_index(:j) = [find(H(:j)) ; zeros(r_num-col_nonzero_number(j)1)];
end
v_l0 = Receive;
for i = 1:r_num % it can be better here by using column assignment %%%
for l = 1:row_nonzero_number(i)
j = row_nonzero_index(il);
v_ml(ij) = v_l0(j);
end % end l
end % end i
%%%%%%%%%%%%%%%%% iteration %%%%%%%%%%%%%%%%%
for it_counter = 1:it_num
%%%%%% check notes(u_ml) updating %%%%%%
% tanh_v_ml = tanh(v_ml/2);
% for i = 1:r_num
% len = row_nonzero_number(i);
% for l = 1:len
% j = row_nonzero_index(il);
% pro = 1;
% for k =1:len
% if k ~= l
% pro = pro * tanh_v_ml(irow_nonzero_index(ik));
% end % end if
% end % end k
% u_ml(ij) = 2*atanh(pro);
% why_error = double(isinf(u_ml(ij)));
% if why_error ~= 0
% u_ml(ij) = sign(u_ml(ij))*1000;
%
相关资源
- Pattern Recognition and Machine Learning(高清
- MATLAB 编程 第二版 Stephen J. Chapman 著
- 均值滤波和FFT频谱分析Matlab代码
- 《MATLAB扩展编程》代码
- HDB3码、AMI码的MATLAB实现
- 3点GPS定位MATLAB仿真
- MATLAB数字信号处理85个实用案例精讲入
- matlab从入门到精通pdf94795
- 基于BP神经网络的语音情感识别系统
- 欧拉放大论文及matlab代码
- 跳一跳辅助_matlab版本
- 全面详解LTE MATLAB建模、仿真与实现
- MIMO-OFDM无线通信技术及MATLAB实现_孙锴
- MATLAB Programming for Engineers 4th - Chapman
- matlab 各种谱分析对比
- 分数阶chen混沌matlab程序
- 基于粒子群算法的非合作博弈的matl
- MATLAB车流仿真 包括跟驰、延误
- matlab空间桁架计算程序
- 基于MATLAB的图像特征点匹配和筛选
- DMA-TVP-FAVAR
- GPS信号的码捕获matlab代码.7z
- 一维光子晶体MATLAB仿真代码吸收率折
- newmark法源程序
- 传统关联成像、计算鬼成像matlab
- pri传统分选算法
- 摆动滚子推杆盘形凸轮设计
- 医学图像重建作业matlab源码
- Matlab实现混沌系统的控制
- 检测疲劳驾驶
评论
共有 条评论