資源簡(jiǎn)介
網(wǎng)絡(luò)數(shù)據(jù)包丟失模型matlab代碼 Gilbert Elliot Model 丟包模型

代碼片段和文件信息
%If?p?is?the?probability?of?transferring?from?Good?State?to?the?bad?state
%and?if?r?is?the?probability?of?transferring?from?the?bad?state?to?the?Good
%state?given?the?p?and?r?values?this?code?will?generate?a?packet?loss
%pattern?(with?burst?losses)?and?save?it?to?a?file?named?Loss_Pattern.txt.
clc
p?=?0.02777;
r?=?0.25;
total_packs?=?10000;
check?=?100;
while?check?>=?10
good?=?1;
packets?=?[];
size?=?1;
while?size?<=?total_packs
if?good?==?1
????packets?=?[packets?good];
????good?=?rand(1)?>?p;
elseif?good?==?0
????packets?=?[packets?good];
????good?=?rand(1)?>?(1-r);
else
????fprintf(‘error\n‘);
????break;
end
size?=?size?+?1;
end
fid?=?fopen(‘Loss_Pattern.txt‘‘w‘);
fprintf(fid?‘%d?‘?packets);
fclose(fid);
received_packs?=?nnz(packets);
theo_pack_loss_rate?=?1?-?r?/?(p+r);
act_pack_loss_rate?=?1?-?received_packs/total_packs;
check?=?abs(theo_pack_loss_rate?-?act_pack_loss_rate)?/?theo_pack_loss_rate?*?100;
end
packets
theo_pack_loss_rate?=?p?/?(p+r)
act_pack_loss_rate?=?1?-?received_packs/total_packs
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????????1082??2017-09-25?19:49??Gilbert?Elliot?Model.m
?????文件???????20000??2017-09-25?19:55??Loss_Pattern.txt
- 上一篇:基于nsct+pcnn的圖像融合
- 下一篇:Polar碼SCL譯碼算法
評(píng)論
共有 條評(píng)論