Stats

Popular Posts

Followers

Mathematica 教學:Central Limit Theorem 2

戴忠淵 於 2014年7月25日星期五 下午7:59 發表




Grid[{{Module[{x,xx,z,temp1,size1},
x={};temp1=1;size1=10;
xx:={(Mean[RandomReal[GammaDistribution[10,2],size1]]-20)*Sqrt[size1]/Sqrt[40]};
Dynamic[Column[{size1,
Histogram[temp1=temp1+1;
If[temp1<=300,x=Join[x,xx],size1=size1+1;temp1=1;x=xx],{-4,4,0.4},"PDF",
Frame->True,Axes->None,PlotRange->{{-4,4},{0,1}},
Epilog->First@Plot[PDF[NormalDistribution[0,1],z],{z,-4,4},PlotStyle->Red]]},
Center]]],

Module[{y,yy,temp2,size2},
y={};temp2=1;size2=10;
yy:={(Mean[RandomVariate[BinomialDistribution[10,0.2],size2]]-2)*
Sqrt[size2]/Sqrt[1.6]};
Dynamic[Column[{size2,
Histogram[temp2=temp2+1;
If[temp2<=300,y=Join[y,yy],size2=size2+1;temp2=1;y=yy],{-4,4,0.4},"PDF",
Frame->True,Axes->None,PlotRange->{{-4,4},{0,1}},
Epilog->First@Plot[PDF[NormalDistribution[0,1],z],{z,-4,4},PlotStyle->Red]]},
Center]]]}}]
Tags: , , ,

讀者回應 ( 0 意見 )

發佈留言

Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.

如果這篇文章對你有幫助,那請留個訊息給我~