資源簡介
本資源是對于數字噴泉碼在高斯信道下的編碼和幾種主要的解碼方式的matlab仿真。

代碼片段和文件信息
K=5;
N=7;
SNR=8;
c?=?0.03;
delta?=?0.2;?%譯碼失敗的概率
msg?=?randsrc(1K[0?1]);
%%
%度分布
f1(1)?=?1/K;
d?=?(2:K);
f1(2:K)?=?1./(d.*(d-1));%理想
S?=?c*log(K/delta)*sqrt(K);
tau?=?zeros(1K);
if?round(K/S)<=K
????d=1:(round(K/S)-1);
????tau(d)=S./(K.*d);
????d=round(K/S);
????tau(d)?=?S/K*log(S/delta);
else
????d=1:K;
????tau(d)=S./(K.*d);
end
Z=sum(tau+f1);
f2?=(f1+tau)/Z;?%魯棒
G=zeros(KN);
coded=zeros(1N);
d?=?randsrc(1N[1:K;f2]);
%%
%編碼
for?i=1:N
????select=randperm(Kd(i));
????G(selecti)=1;
????coded(i)=mod(sum(G(:i).*msg‘)2);
end
%?disp(msg);
disp(G);
disp(coded);
%%
%?%傳輸
%?msgtr=2*coded-1;
%?Sigman2?=?1/10^(SNR/10);
%?n?=?randn(1N)/sqrt(2)*sqrt(Sigman2);
%?coded=n+msgtr;
%?coded(coded>0)=1;
%?coded(coded<=0)=0;
%%
%BP
flgEndLoop?=?0;
i=1:N;
remsg?=?zeros(1K);
degree(i)=sum(G(:i));
degreeone=find(degree==1);
while?~isempty(degreeone)
????locate=zeros(1length(degreeone));%度為一對應的初始碼元
???for?j=1:length(degreeone)
???????if?find(G(:degreeone(j)))~=0
????????????locate(j)=find(G(:degreeone(j))==1);
????????????remsg(locate(j))=coded(degreeone(j));%找到度為1的編碼并譯出來
????????????match=find(G(locate(j):)==1);%找到相連的邊
????????????coded(match)=xor(coded(match)coded(degreeone(j)));%更新信息,異或
????????????G(locate(j):)=0;%拆除相連邊
????????else
????????end
???end
????degree(i)=sum(G(:i));%再次譯碼
????degreeone=find(degree==1);
end
%?v=sum(xor(msgremsg));
disp(msg);
disp(remsg);
%?disp(v);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1527??2018-01-13?14:06??BP_test_R.m
?????文件???????3587??2018-01-11?16:27??GE_test_R.m
?????文件???????1910??2018-01-13?19:41??OFG_test_R.m
-----------?---------??----------?-----??----
?????????????????7024????????????????????3
評論
共有 條評論