实验6蒙特卡洛模拟.docVIP

  • 10
  • 0
  • 约2.73千字
  • 约 4页
  • 2016-10-15 发布于河南
  • 举报
实验6蒙特卡洛模拟

Using Monte Carlo simulation, write a Matlab program to calculate an approximation to ( by considering the number of random points selected inside the quarter circle where the quarter circle is taken to be inside the square n=50000; counter=0; for k=1:n x=rand(1); y=rand(1); if x.^2+y.^2=1 counter=counter+1; end end PI=4.*counter./n 运行结果: PI = 3.1420 Using Monte Carlo simulation, write a Matlab program to calculate the volume of an ellipsoid(椭球体) n=50000; counter=0; for k=1:n x=rand(1)*6; y=rand(1)*8; z=

文档评论(0)

1亿VIP精品文档

相关文档