敬业的IT人 >> 编程开发 >> 其他语言 >> Calton板的数值模拟

Calton板的数值模拟

敬业的IT人 互联网 佚名 2008-2-19 18:02:16
    ·磁盘阵列(Disk Array)原理

                                                                1

 

       3实验代码:

%----simulate of calton board----

 

%--global variable--

 

% the possibility of left drop direction.

  p=0.7;

% the level that the ball should pass

  level=7;

% the number of the ball generated which in one trial.

  n_balls=10000;

% array to store the num in each tunnel.

  a=zeros(1,level+1);

  aStatics=zeros(1,n_balls);

% the tunnel looks from left.

  leftPos=1;

 

% iter val

  i=0;

  iBallCount=0;

  tmpRnd=0; 

 

%--core simulatioin--

  %total ball simulate

  while iBallCount<n_balls

              %--each ball selection--

              i=0;leftPos=1;

              %drop levels selection

              while i<level

                    tmpRnd=rand(1,1);

                    %select forward direction.

                    if(tmpRnd>=p)

                         leftPos=leftPos+1;

                    end     

                    i=i+1; 

              end

              %note each simulation ball's last pos.

              a(leftPos)=a(leftPos)+1;

           aStatics(iBallCount+1)=leftPos;

          

        iBallCount=iBallCount+1;

  end

 

  hist(aStatics,level+1)

 

       4实验结果:

       2及图3展示了测试粒子为10000粒子时,左转概率p分别为0.50.7的分布情况,可以看出,结果很好的验证了Calton板的极限分布服从二项分布这一推论。                                    

Calton板的数值模拟(图二)

点击查看大图

2

Calton板的数值模拟(图三)

点击查看大图

3

参考文献: 

[1]基于MatlabCalton板实验仿真设计及实现,计算机仿真,2006.3

                                                                                                         程序完成日:06/04/30

                                                                                                         文章完成日:06/05/01

 

附录:

1测试程序下载:

http://emilmatthew.51.net/EmilPapers/06_15Calton/code.rar

若直接点击无法下载(或浏览),请将下载(或浏览)的超链接粘接至浏览器地址栏后按回车.若不出意外,此时应能下载。

若下载中出现了问题,请参考:

http://blog.csdn.net/emilmatthew/archive/2006/04/08/655612.aspx

进入讨论组讨论。
粤ICP备06119539号
Copyright CiscoSky.Org,Some Rights Reserved.
Email:me1228#tom.com