奇偶校验电路MATLAB设计,如何用Matlab生成一个奇偶校验矩阵

%具体说明见:http://arun-10。tripod。com/ldpc/generate。html%GENERATING THE PARITY CHECK MATRIXfunction [H]=gen_ldpc(rows,cols)%H=gen_ldpc(rows,cols)%For examples and more details, please refer to the LDPC too...
摘要由CSDN通过智能技术生成

%具体说明见:http://arun-10。tripod。com/ldpc/generate。html

%GENERATING THE PARITY CHECK MATRIX

function [H]=gen_ldpc(rows,cols)

%H=gen_ldpc(rows,cols)

%For examples and more details, please refer to the LDPC toolkit tutorial at

%http://arun-10。

tripod。com/ldpc/ldpc。

htm

bits_per_col=3;

for i=1:rows

row_flag(i)=0;

for j=1:cols

parity_check(i,j)=0;

end

end

�d bits_per_col 1's to each column with the only constraint being that the 1's should be

%placed in distinct rows

for i=1:cols

a=randperm(rows);

for j=1:bits_per_col

parity_check(a(j),i)=1;

row_flag(a(j))=row_flag(a(j)) 1;

end

end

row_flag;

max_ones_per_row=ceil(cols*bits_per_col/rows);

parity_check;

�d 1's to rows having no 1(a redundant row) or only one 1(that bit in the codeword becomes

%zero irrespective of the input)

for i=1:rows

if row_flag(i)==1

j=unidrnd(cols);

while parity_check(i,j)==1

j=unidrnd

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值