Matlab动画模拟分子布朗运动的示例

来源:互联网 发布:松江的主机怎么编程 编辑:程序博客网 时间:2024/05/16 19:48

Matlab动画模拟分子布朗运动的示例

%Brownian motion clf; n=20; s=0.02; x = rand(n,1)-0.5; y = rand(n,1)-0.5; h = plot(x,y,'.'); axis([-1 1 -1 1]) axis square grid off set(h,'EraseMode','xor','MarkerSize',18) grid on; title('Press Ctl-C to stop'); while 1  drawnow  x = x + s*randn(n,1);  y = y + s*randn(n,1);  set(h,'XData',x,'YData',y) end



来源:http://www.bime.ntu.edu.tw/~dsfon/Mechanism2/%E5%8B%95%E4%BD%9C%E7%9A%84%E5%90%88%E6%88%90.PDF

0 0