Matlab:利用Matlab实现布朗运动模拟
Matlab:利用Matlab实现布朗运动模拟
输出结果
实现代码
n=40
s=0.04
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',12)
while 1
drawnow
x=x+s*randn(n,1);
y=y+s*randn(n,1);
set(h,'XData',x,'YData',y)
end
赞 (0)