注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Mr.Right

不顾一切的去想,于是我们有了梦想。脚踏实地的去做,于是梦想成了现实。

 
 
 

日志

 
 
关于我

人生一年又一年,只要每年都有所积累,有所成长,都有那么一次自己认为满意的花开时刻就好。即使一时不顺,也要敞开胸怀。生命的荣枯并不是简单的重复,一时的得失不是成败的尺度。花开不是荣耀,而是一个美丽的结束,花谢也不是耻辱,而是一个低调的开始。

网易考拉推荐

中心极限定理的matlab演示  

2012-08-31 13:34:06|  分类: 编程 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

% Script that demonstrates the central limit theorem by showing the
% probability distribution of random variables composed of varying
% numbers of non-normally-distributed components.
% Because real-world quantities are often the balanced sum of many 
% unobserved random events, the central limit theorem provides a partial 
% explanation for the prevalence of the normal probability distribution.
% In the expressions below, the rand functions provides a uniformly-
% distributed variable. You can include additional functions, such as
% sqrt(rand), sin(rand), rand^2, log(rand), to obtain other distributions.
% No matter what the distribution of the single variable, but the
% time you combine four of them, the resulting distribution is normal.
NumPoints=100000; % The length of the random variable arrays.
NumBins=50; % The numnber of bins in the histograms
subplot(2,2,1)
SingleVariable=rand(NumPoints,1);
hist(SingleVariable,NumBins)
title('Single random variable')
xlabel(['STD = ' num2str(std(SingleVariable)) ])
subplot(2,2,2) 
TwoVariables=rand(NumPoints,1)-rand(NumPoints,1);
hist(TwoVariables,NumBins)
title('Two random variables')
xlabel(['STD = ' num2str(std(TwoVariables))])
subplot(2,2,3) 
FourVariables=rand(NumPoints,1)-rand(NumPoints,1)-rand(NumPoints,1)+rand(NumPoints,1);
hist(FourVariables,NumBins)
StandardDeviation4=std(FourVariables);
xlabel(['STD = ' num2str(StandardDeviation4)])
title('Four random variables')
% The 4th plot shows a normal distrubution obtained by using the
% randn function, for comparison.
subplot(2,2,4) 
RANDNvariable=randn(NumPoints,1);
hist(RANDNvariable,NumBins)
title('Normal distribution')
StandardDeviationRANDN=std(RANDNvariable);
xlabel(['STD = ' num2str(StandardDeviationRANDN)])
  评论这张
 
阅读(757)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016