主题: [MATLAB数学相关] 求极限
查看单个帖子
旧 2009-11-03, 18:57   #1
nnsghhz
初级会员
 
注册日期: 2009-11-03
帖子: 1
声望力: 0
nnsghhz 正向着好的方向发展
默认 求极限

matlab程序如下,现要求当Nfinal趋向于正无穷时,P1和P2的值

Nfinal=1e6;
P=0;
Q=0;
for N=1:Nfinal;
pp=rand(1,2);
Q=Q+(1./(1+pp(1,1).^2)>=pp(1,2));
P=P+(pp(1,1)./(1+pp(1,1).^2)>=pp(1,2));
end
P1=Q/Nfinal
P2=P/Nfinal
nnsghhz 当前离线   回复时引用此帖