主题:模拟一个误码信道——帮帮忙啦,走过路过进来看看撒
learningC
[专家分:0] 发布于 2010-07-21 17:00:00
要编一个误码信道,且误码率可以设定,类似加干扰一样。
我是想说产生0,1随机数让1处产生误码,但是那样的话怎么能限定1的个数来使它达到一定的误码率?
还是说有别的办法可以编这样一个误码信道,请高人指点!
最后更新于:2010-07-21 16:30:00
回复列表 (共6个回复)
沙发
bruceteen [专家分:42660] 发布于 2010-07-21 20:07:00
用随机函数 rand() 嘛
比如在VC上,RAND_MAX 是 0x7fff,也就是产生 0 到 0x7fff 的随机数
如果你需要33.33%的几率,那么就是 if( rand() < (1+RAND_MAX)/3 )
如果你觉得 0x7fff 还太小的话,那你可以用 (1+RAND_MAX)*rand() + rand() 来扩充到 3FFFFFFF,还不够的话,用 (1+RAND_MAX)*(1+RAND_MAX)*rand() + (1+RAND_MAX)*rand() + rand() 来扩充到 1FFFFFFFFFFF
板凳
雪光风剑 [专家分:27190] 发布于 2010-07-21 20:09:00
我的想法,
比如期望误码率是A
那么不妨设计0~1/A的伪随机函数,取到特定值触发误码。误码率也只是一个期望,只能大概服从而难以严格符合
3 楼
learningC [专家分:0] 发布于 2010-07-22 09:54:00
我用这个产生随机的01序列
j=(int)(2.0*rand()/(RAND_MAX+1.0));//产生随机0 1序列
那么1的个数要一定的概率限制,是怎么实现,
“如果你需要33.33%的几率,那么就是 if( rand() < (1+RAND_MAX)/3 )”
这是什么的几率达到33.33% ,这个式子怎么得来的?
谢谢!!
4 楼
xingxing01 [专家分:0] 发布于 2010-07-27 15:58:00
I'm sure [url=http://www.toppowerlevel.net]wow power leveling[/url] this will come as no surprise. What with all the talk about security holes, and the advanced age of the browser [url=http://www.mogxe.com/PowerLevel.php?gid=1]wow power leveling[/url] (what, nine years now?), major websites are dropping IE6 support [url=http://www.toppowerlevel.net/powerlist.php?fid=688]wow power leveling[/url] left and right—and that's not to mention the specific concern about the security [url=http://www.mogxe.com/PowerLevel.php?gid=1]world of warcraft power leveling[/url] of WoW accounts.
So let us say officially: We will shortly be dropping [url=http://www.toppowerlevel.net/buy.php]wow cheap gold[/url] support for Internet Explorer 6 (IE6).
Now for those of you who are stuck with this geriatric [url=http://www.toppowerlevel.net/buy.php]gold for wow[/url] browser for whatever reason, don't despair! This isn't quite as harsh as it sounds—it [url=http://www.toppowerlevel.net]world of warcraft power leveling[/url] doesn't mean the page is suddenly going to stop working completely in IE6. [url=http://www.toppowerlevel.net/powerlist.php?fid=7422]cheap aion power leveling[/url] It only means that if we make a change or an update that makes the page look funny in IE6...well, we're not going to lose any sleep over it.[url=http://www.mogxe.com/PowerLevel.php?gid=21]cheap aion power leveling[/url]
No longer worrying about maintaining support for this old browser will enable us to spend more time developing new features, and to make sure we're taking advantage of all the technological advances newer browsers have to offer.
5 楼
xingxing01 [专家分:0] 发布于 2010-07-27 15:59:00
I'm sure [url=http://www.toppowerlevel.net]wow power leveling[/url] this will come as no surprise. What with all the talk about security holes, and the advanced age of the browser [url=http://www.mogxe.com/PowerLevel.php?gid=1]wow power leveling[/url] (what, nine years now?), major websites are dropping IE6 support [url=http://www.toppowerlevel.net/powerlist.php?fid=688]wow power leveling[/url] left and right—and that's not to mention the specific concern about the security [url=http://www.mogxe.com/PowerLevel.php?gid=1]world of warcraft power leveling[/url] of WoW accounts.
So let us say officially: We will shortly be dropping [url=http://www.toppowerlevel.net/buy.php]wow cheap gold[/url] support for Internet Explorer 6 (IE6).
Now for those of you who are stuck with this geriatric [url=http://www.toppowerlevel.net/buy.php]gold for wow[/url] browser for whatever reason, don't despair! This isn't quite as harsh as it sounds—it [url=http://www.toppowerlevel.net]world of warcraft power leveling[/url] doesn't mean the page is suddenly going to stop working completely in IE6. [url=http://www.toppowerlevel.net/powerlist.php?fid=7422]cheap aion power leveling[/url] It only means that if we make a change or an update that makes the page look funny in IE6...well, we're not going to lose any sleep over it.[url=http://www.mogxe.com/PowerLevel.php?gid=21]cheap aion power leveling[/url]
No longer worrying about maintaining support for this old browser will enable us to spend more time developing new features, and to make sure we're taking advantage of all the technological advances newer browsers have to offer.
6 楼
酱爆鱼虾蟹 [专家分:40] 发布于 2010-07-27 20:52:00
我觉得可以产生一个随机数--转二进制--取须要的数字的个数--转成字符--统计0或1个数--设计1转零或零转1--转回数字....
我来回复