# MATLAB代做|FPGA代做|Python代做--mackey译码算法

### 时间：2019-1-24 20:33:52 点击：

核心提示：MATLAB代做|FPGA代做|Python代做--mackey译码算法...
%function [H]=mackay( )
testrank=1;
while testrank==1
m=24;
n=48;
j=3;
k=6;
x=round(m/j);
r=1-m/n;
test=1;
H=zeros(m,n);
maxnum=1000;
maxselectnum=1000;
num=1;
for mm=1:m
deg(mm)=0;
end
while (test==1)%&(num<=maxnum)

H=zeros(m,n);
U=[];
for nn=1:n

test3=1;
nn;
U=[];
if (nn==1)
for jj=1:j
U(jj)=randint(1,1,[(jj-1)*x+1,min(jj*x,m)]);
H(U(jj),nn)=1;
deg(U(jj))=deg(U(jj))+1;
end
else
selectnum=1;
%test1=1;
while (test3==1)

H(:,nn)=0;
U=[];
for jj=1:j
if jj==1
test1=1;
while test1==1
U(jj)=randint(1,1,[1,m]);
if deg(U(jj))>k
test1=1;
else
test1=0;
end
end

else
l=1;
test2=1;
while (l==1)||(test2==1)
U(jj)=randint(1,1,[1,m]);
if deg(U(jj))>k
test2=1;
else
test2=0;
end

numu=0;
for jjj=1:jj-1
if U(jj)==U(jjj)
numu=numu+1;
end
end
if numu~=0
l=1;

else
l=0;

end

end
end

H(U(jj),nn)=1;
deg(U(jj))=deg(U(jj))+1;
end

numcycle=0;
for t=2:j
for jj=t:j
for nnn=1:nn-1
if (H(U(t-1),nn)+H(U(t-1),nnn)+H(U(jj),nn)+H(U(jj),nnn))==4

numcycle=numcycle+1;
end

end
end
end
if numcycle~=0
test3=1;
else
test3=0;

end
selectnum=selectnum+1;
if selectnum>maxselectnum
test=1;
break;
else
test=0;
end
end%end while

end%end if
end %end for
num=num+1;
if num>maxnum
break;
end
end% end while
for nn=1:n
lie(nn)=sum(H(:,nn));
end
for mm=1:m
hang(mm)=sum(H(mm,:));
end
loop_size=4;
A=[];
A=[zeros(m),H;H.',zeros(n)];
A2=A^(loop_size/2);
A3=A^(loop_size-1);
A0=eye(m+n);
cycle_total_4=0;
cycle_total_6=0;
for i=1:m+n
for j=1:m+n
if (A2(i,j)>2||A2(i,j)==2)&A0(i,j)==0%找到长为4的环
cycle_total_4=cycle_total_4+1;
end
if (A3(i,j)>2||A3(i,j)==2)&A(i,j)==0%找到长为6的环
cycle_total_6=cycle_total_6+1;
end
end
end
rankh=rank(H);
if rankh==m
testrank=0;
else
testrank=1;
end
end

QQ ：1224848052

• 百度搜索
• 查阅资料过程中
• 论坛发现
• 百度贴吧发现
• 朋友介绍
• 没有相关文章
• 大名：
• 内容：