clc;clear;
G = [ 1 1 0 1
0 1 1 1
0 1 1 0]
[m,n] = size(G);
y = [0 1 1 1];
x = ones(1,m)
while(1)
%***********判斷準備開始1*****************
for i = 1:n
front_judge = length(find(G(:,i)==1));
end
%***********判斷準備結束1*****************
for j = 1:n
index_y = find(G(:,j)==1);
if length(index_y)==1 %度1
x(index_y) = y(j);%賦值
G(index_y,j) = 0; %刪邊
for jj = 1:n
if G(index_y,jj)==1
y(jj) = xor(x(index_y),y(jj));
G(index_y,jj)=0;
end
end
end
end
%***********判斷準備開始2*****************
for i = 1:n
last_judge = length(find(G(:,i)==1));
end
%***********判斷準備結束2*****************
if last_judge==front_judge
break;
end
end
x
噴泉碼LT譯碼程序
最新推荐文章于 2023-08-31 23:24:08 发布