正在加载图片...
Abellcurvem COde 1.1 of Random Eigenvalues by Alan Edelman 7Experiment: Generate random samples from the normal distribution oBservation: Histogram the random samples / Theory Falls on trials=100000: dx= 2 v=randn(1, trials); [count, x]=hist(v, [-4: dx: 41) hold off, b=bar( t/(trials*dx),'y): hold on x=-4:01:4 lot(x, exp(-x. 2/2)/sqrt(2*pi),'LineWidth', 2) is([-440 Code 1 3 How Accurate Are Histograms When playing with Code 1, the reader will happily see that given enough trials the histogram is close to the true bell curve. One can press further and ask how close? Multiple experiments will show that some of the bars may be slightly too high while others slightly too low. There are many experiments which we explore in the exercises to try to understand this more clearly. We will discuss these as the course progresse 4 HISt: rmalized histogram We can incorporate the ideas discussed above into the following MATLAB code� � � � %bellcurve.m %Code 1.1 of Random Eigenvalues by Alan Edelman %Experiment: Generate random samples from the normal distribution. %Observation: Histogram the random samples. %Theory: Falls on a bell curve. trials=100000; dx=.2; v=randn(1,trials);[count,x]=hist(v,[-4:dx:4]); hold off, b=bar(x,count/(trials*dx),’y’); hold on x=-4:.01:4; plot(x,exp(-x.^2/2)/sqrt(2*pi),’LineWidth’,2) axis([-4 4 0 .45]); Code 1 3 How Accurate Are Histograms? When playing with Code 1, the reader will happily see that given enough trials the histogram is close to the true bell curve. One can press further and ask how close? Multiple experiments will show that some of the bars may be slightly too high while others slightly too low. There are many experiments which we explore in the exercises to try to understand this more clearly. We will discuss these as the course progresse 4 HISTN: Normalized Histogram We can incorporate the ideas discussed above into the following MATLAB code
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有