- 1、本文档共4页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
MATLAB实验报告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
count=0;
n=10000;
for i=1:n
x(i)=rand(1);
y(i)=sqrt(1-(x(i))^2);
z=rand(1);
if z=y(i)
count=count+1;
end;
end;
s=count/n
PI=4*s
结果:s =0.7869 PI =3.1476
s =0.7819 PI =3.1276
s =0.7828 PI =3.1312
Using Monte Carlo simulation, write a Matlab program to calculate the volume of an ellipsoid(椭球体)
count=0;
n=10000;
for i=1:n
x(i)=sqrt(32)*rand(1);
y(i)=8*rand(1);
z(i)=sqrt(8*16-4*(x(i))^2-2*(y(i))^2);
u=sqrt(128)*rand(1);
if u=z(i)
count=count+1;
end;
end;
v=4*count/n*sqrt(32*64*128)
结果:
v =
1.0758e+003
v =
1.0627e+003
v =
1.0818e+003
3、Use Monte Carlo simulation to simulate the rolls of an unfair die. Assume the die is biased according to the following empirical distribution:
Roll Value Probability 1 0.1 2 0.1 3 0.2 4 0.3 5 0.2 6 0.1 设pi(i=1,2,3,4,5,6)表示色子显示i点的概率。
count=[0 0 0 0 0 0];
n=12000;
for i=1:n
x(i)=rand(1);
if x(i)=0.1
count(1)=count(1)+1;
elseif x(i)0.1 x(i)=0.2
count(2)=count(2)+1;
elseif x(i)0.2 x(i)=0.4
count(3)=count(3)+1;
elseif x(i)0.4 x(i)=0.7
count(4)=count(4)+1;
elseif x(i)0.7 x(i)=0.9
count(5)=count(5)+1;
else
count(6)=count(6)+1;
end;
end;
for k=1:6
p(k)=count(k)/n;
end
for i=1:6
fprintf(p%d:%f ,i,p(i));
end
结果:
p1:0.105083 p2:0.097583 p3:0.202917 p4:0.294667 p5:0.203333 p6:0.096417
p1:0.095750 p2:0.098667 p3:0.208333 p4:0.297000 p5:0.201250 p6:0.099000
p1:0.098417 p2:0.100000 p3:0.198417 p4:0.299917 p5:0.194250 p6:0.109000
4.You arrive at the beach for a seven-day vacation and are dismayed to learn that the local weather prediction is predicting a 50% chance
您可能关注的文档
- 2012新课标卷1.doc
- 2012级电子商务人才培养方83.doc
- 2013年半年总结初稿2.doc
- 2013上海中考二模24题汇总.doc
- 2012年高考题(水循环部分).doc
- 2013年秋八上英语单词练习表.doc
- 2013重庆大学研究生院分团委书记联席会材料汇编.doc
- 2014-2015年度盘山县实验学校师徒结对子.doc
- 2014--2015武昌区八年级期末.docx
- 2014pep英语六年级小升初重点句型讲解练习.doc
- 4.1 陆地水体及其关系 课件高二上学期地理中图版(2019)选择性必修一.pptx
- 混凝土结构与砌体结构设计习题集 .pdf
- 统编版语文四年级下册 22.古诗三首 课件(共50张PPT).pptx
- 青海2024行测笔试真题及答案 .pdf
- 2.1 充分发挥市场在资源配置中的决定性作用 课件-高中政治统编版必修二经济与社会.pptx
- 27.巨人的花园 课件(共58张PPT).pptx
- 统编版语文一年级下册5 树和喜鹊 第1课时 课件(共37张PPT).pptx
- 2.1 充分发挥市场在资源配置中的决定性作用 课件政治一轮复习统编版必修二经济与社会.pptx
- 贵港市平南县2024届小升初考试语文试卷含答案 .pdf
- 小学期末考试质量分析 .pdf
最近下载
- 2025年高考地理二轮复习非选择题强化训练(课件).pptx VIP
- (二模)2025年广州市普通高中毕业班综合测试(二)数学试卷(含答案详解).pdf
- 14J938 抗爆、泄爆图集标准.docx VIP
- 降低CRRT治疗非计划下机率.pptx VIP
- 《中国心力衰竭诊断和治疗指南2024》解读(下).pptx
- 《预检分诊》课件.pptx VIP
- 2024年河南省政务服务办事员职业技能竞赛考试题库-下(判断、简答题汇总).docx
- 2025年部编版语文六年级毕业复习知识点.pdf VIP
- 2025年政务服务办事员技能大赛理论考试题库600题(含答案).docx
- 14J938抗爆泄爆图集标准.docx VIP
文档评论(0)